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






Prints "3". Flips and flops back when x==3


(1..10).each {|x| print x if x==3..x>=3 }

 

Related examples in the same category

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