Prints "34". Flips when x == 3 and flops when x==4 : each « Range « Ruby






Prints "34". Flips when x == 3 and flops when x==4


(1..10).each {|x| print x if x==3...x>=3 } # Prints "34"

 

Related examples in the same category

1.A sub range
2.Prints "3". Flips and flops back when x==3