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 differentfunctions.

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 argumentis a substring of the string.

That is why the output is different.

Vikhyat Korrapati
http://vikhyat.net/