Matthew K. Williams wrote:
> On Fri, 17 Jul 2009, F. Senault wrote:
>
>> Le 16 juillet 2009 18:58, Tom Cloyd a ñÄrit :
>>
>>> x='1'
>>> case
>>> when x =='0'
>>>   puts '0'
>>> when (1..5).include? x.to_i
>>>   puts '1'
>>> end
>>
>> When in doubt, parenthesise :
>>
>>>> case
>> ?>     when x == '0'
>>>>       puts '0'
>>>>     when (1..5).include?(x.to_i)
>>>>       puts '1'
>>>>     end
>> 1
>> => nil
>>
>
> Seconded.  You could also have said:
>
> when ((1..5).include? x.to_i)
>
>
> In ruby, parenthesis are optional.... except when they aren't. ;-)
>
> Matt
Fred, Matt,

Yeah. It was amazing how many problems I just solved with a few 
parentheses. Yikes! No syntactic sugar here...but the code's working, so 
all's well.

Thanks so much for the  quick, accurate diagnosis.

t.

-- 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tom Cloyd, MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< tc / tomcloyd.com >> (email)
<< TomCloyd.com >> (website) 
<< sleightmind.wordpress.com >> (mental health weblog)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~