Ruby/Range/each
Материал из Wiki.crossplatform.ru
Версия от 17:10, 26 мая 2010; (Обсуждение)
A sub range
(1..10).each {|x| print x if x==3..x==5 }
Prints "34". Flips when x == 3 and flops when x==4
(1..10).each {|x| print x if x==3...x>=3 } # Prints "34"
Prints "3". Flips and flops back when x==3
(1..10).each {|x| print x if x==3..x>=3 }