From: Vikhyat Korrapati Date: 2012-01-22T05:49:40+09:00 Subject: Re: DIfferent outputs? On Sunday 22 January 2012 at 2:16 AM, josh smith wrote: > Hi, > > So im a newb to ruby. Just started learning today morning. > I tried the following two cases but can not figure out why the outputs > are different. > > [“recycler”].include?(‘recycle’) > > False > > “recycler”.include?(‘recycle’) > > True > Hi, The .include? method on an array and the one on a string have different functions. For an array, .include? will check whether any of the elements are equal to the argument, while in a string it will check whether the argument is a substring of the string. That is why the output is different. Vikhyat Korrapati http://vikhyat.net/