N
nonno_lele
Hello there,
I'm newbie with ruby and to be onest I'm quite surprised about a
strange behaviour I found:
How the interpreter works with this lines looks odd to me:
def dummy?
(true or false )
end
This one has no problem... and also this one:
def dummy?
(true or
false )
end
But what happen when you split the boolean condition into 2 different
lines and u put the OR in the 2nd line??
def dummy?()
(true
or false )
end
U get *"syntax error, unexpected kOR, expecting ')' "*
I agree that the interpreter is not able to undestand this one:
def dummy?()
true
or false
end
because of the missing () and return... but using the ( ) it should
work.
At least using Return and ( ) should work..
def dummy?()
return (true
or false )
end
But it is not.
Where is my fault? Looks strange to me that an high level language
forces you to think about in which position you've to put the OR.
Is there a way to force the interpreter to evaluate the block inside
the () before anything else?
Thanks in advance ,
Regards,
Em.
PS: ive found an old discussion about the same error but I'm not sure
this answer my question:
http://tinyurl.com/2852ns
PS2: using || instead of OR gives the same result.
cheers.
I'm newbie with ruby and to be onest I'm quite surprised about a
strange behaviour I found:
How the interpreter works with this lines looks odd to me:
def dummy?
(true or false )
end
This one has no problem... and also this one:
def dummy?
(true or
false )
end
But what happen when you split the boolean condition into 2 different
lines and u put the OR in the 2nd line??
def dummy?()
(true
or false )
end
U get *"syntax error, unexpected kOR, expecting ')' "*
I agree that the interpreter is not able to undestand this one:
def dummy?()
true
or false
end
because of the missing () and return... but using the ( ) it should
work.
At least using Return and ( ) should work..
def dummy?()
return (true
or false )
end
But it is not.
Where is my fault? Looks strange to me that an high level language
forces you to think about in which position you've to put the OR.
Is there a way to force the interpreter to evaluate the block inside
the () before anything else?
Thanks in advance ,
Regards,
Em.
PS: ive found an old discussion about the same error but I'm not sure
this answer my question:
http://tinyurl.com/2852ns
PS2: using || instead of OR gives the same result.
cheers.