Paganoni
3/22/2009 7:00:00 PM
le 22/03/2009 14:53, François Montel nous a dit:
> Can anyone explain this?
>
>>> a = ["b"]
> => ["b"]
>>> a == "b"
> => false
>>> "#{a}" == "b"
> => true
>
> Since a is an array, how come the last statement evaluates as true?
Because, since it's embedded in a string Ruby does a .to_s against the
array. And ["b"].to_s == "b" is true