How to use for loop with next to skip the rest of the current iteration in Ruby

1 Answer

0 votes
for x  in  1..10
    if  x < 5 then
        next
    end
    puts "x=#{x}"
    x += 1
end
 
 
 
# run:
#
# x=5
# x=6
# x=7
# x=8
# x=9
# x=10
#

 



answered Dec 22, 2020 by avibootz
...