A sub range : each « Range « Ruby






A sub range



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

 

Related examples in the same category

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