Parv_G
(Parv G)
1
hi,
i would like to do something like the following
if true
do_a
else
d_a
d_b
end
Can this be done using ternary operator?
This seem to give different result:
ifTrue ? do_a : do_a and do_b
Thank you.
···
--
Posted via http://www.ruby-forum.com/.
Parv G. wrote:
hi,
i would like to do something like the following
if true
do_a
else
d_a
d_b
end
Can this be done using ternary operator?
This seem to give different result:
ifTrue ? do_a : do_a and do_b
'and' is very low precendence operator, and also will only do_b if the
result of do_a is true.
ifTrue ? do_a : (do_a, do_b)
···
--
Posted via http://www.ruby-forum.com/\.
Hi,
At Fri, 5 Jun 2009 05:54:48 +0900,
Brian Candler wrote in [ruby-talk:338415]:
ifTrue ? do_a : (do_a, do_b)
You need a semicolon instead of a comma.
···
--
Nobu Nakada
Nobuyoshi Nakada wrote:
Brian Candler wrote in [ruby-talk:338415]:
ifTrue ? do_a : (do_a, do_b)
You need a semicolon instead of a comma.
Sorry, that's me with my C head on
···
--
Posted via http://www.ruby-forum.com/\.