2010/4/30 Michel Demazure <michel / demazure.com>: > 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. Why? What use case is there that would require this or what code would become (much) more elegant? Note that the cost (in terms of memory) might be significant if the expression before "while" returns a large volume of data on each iteration. That's probably irrelevant for most cases but it may cause a nasty memory issues in rare cases because every last value needs to be kept for the duration of the next loop execution. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/