What surprised me most learning about Ruby’s ranges was that you could loop over ranges of arbitrary boolean expressions like while test_begin .. test_end. I can’t think of other languages that let you loop quite like that.
while test_begin .. test_end
That’s not a range, even though the syntax often make people think they are.
What you are mentioning is flip flops: https://en.wikipedia.org/wiki/Flip-flop_(programming)
Much of the weird stuff in Ruby is copied from Perl
What surprised me most learning about Ruby’s ranges was that you could loop over ranges of arbitrary boolean expressions like
while test_begin .. test_end. I can’t think of other languages that let you loop quite like that.That’s not a range, even though the syntax often make people think they are.
What you are mentioning is flip flops: https://en.wikipedia.org/wiki/Flip-flop_(programming)
Much of the weird stuff in Ruby is copied from Perl