M
Michel Demazure
This is logical, but no very useful :
irb(main):007:0> x = 10
=> 10
irb(main):008:0> x = x + 1 if false
=> nil
irb(main):009:0> x = x + 1 if true
=> 11
Idem, a while modifier always returns nil
irb(main):010:0> x += 1 while x < 15
=> nil
It would be nice to get the return value of the last instruction
*before* the test fails.
_md
irb(main):007:0> x = 10
=> 10
irb(main):008:0> x = x + 1 if false
=> nil
irb(main):009:0> x = x + 1 if true
=> 11
Idem, a while modifier always returns nil
irb(main):010:0> x += 1 while x < 15
=> nil
It would be nice to get the return value of the last instruction
*before* the test fails.
_md