P
Peña, Botp
Hi All, apologies in advanced if this has been discussed already
why does ruby not compile the following case-when clause if using "and" =
or "or" ? It works if i replace it with "&&" or "||", but i'm not asking =
nor using that, "and/or" are much friendlier.
samples,
irb(main):038:0> case
irb(main):039:1* when 1=3D=3D1 or 2=3D=3D2
irb(main):040:1> puts "ok"
irb(main):041:1> end
SyntaxError: compile error
(irb):39: syntax error, unexpected kOR, expecting kTHEN or ':' or '\n' =
or ';'
when 1=3D=3D1 or 2=3D=3D2
^
(irb):41: syntax error, unexpected kEND, expecting $end
from (irb):41
from ?:0
irb(main):050:0> case
irb(main):051:1* when 1=3D=3D1 and 2=3D=3D2
irb(main):052:1> puts "ok"
irb(main):053:1> end
SyntaxError: compile error
(irb):51: syntax error, unexpected kAND, expecting kTHEN or ':' or '\n' =
or ';'
when 1=3D=3D1 and 2=3D=3D2
^
(irb):53: syntax error, unexpected kEND, expecting $end
from (irb):53
from :0
thank you and kind regards -botp
why does ruby not compile the following case-when clause if using "and" =
or "or" ? It works if i replace it with "&&" or "||", but i'm not asking =
nor using that, "and/or" are much friendlier.
samples,
irb(main):038:0> case
irb(main):039:1* when 1=3D=3D1 or 2=3D=3D2
irb(main):040:1> puts "ok"
irb(main):041:1> end
SyntaxError: compile error
(irb):39: syntax error, unexpected kOR, expecting kTHEN or ':' or '\n' =
or ';'
when 1=3D=3D1 or 2=3D=3D2
^
(irb):41: syntax error, unexpected kEND, expecting $end
from (irb):41
from ?:0
irb(main):050:0> case
irb(main):051:1* when 1=3D=3D1 and 2=3D=3D2
irb(main):052:1> puts "ok"
irb(main):053:1> end
SyntaxError: compile error
(irb):51: syntax error, unexpected kAND, expecting kTHEN or ':' or '\n' =
or ';'
when 1=3D=3D1 and 2=3D=3D2
^
(irb):53: syntax error, unexpected kEND, expecting $end
from (irb):53
from :0
thank you and kind regards -botp