Tom Cloyd
2/19/2009 9:08:00 AM
Stefano Crocco wrote:
> Alle Thursday 19 February 2009, Tom Cloyd ha scritto:
>
>> I just set up my first ternary operator expression, and got a warning
>> from Ruby, as a reward! I don't see what the problem might be:
>>
>> The expression:
>> db_type= 'n' ? db = @nodes_h : db = @links_h
>>
>> The warning:
>> ../lib/setnet/SN.rb:781: warning: string literal in condition
>>
>> I use string literals all the time in case statements, and other places,
>> and have never had this objection.
>>
>> Can someone explain the problem to me? I cannot imagine what it might be.
>>
>> Thanks!
>>
>> t.
>>
>
> Ruby thinks you are likely to have written = instead of == in the condition.
>
> Stefano
>
>
>
>
Geee, I wonder why? Good Lord!
A real newbie mistake!
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)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~