I was doing the prime factor exercise on Project Euler and came across the next statement.
for i in 0..5
if i < 2 then
next
end
puts "Value of local variable is #{i}"
end
the next command or statement jumps or skips to the next iteration of the innermost loop.
The code above will produce:
Value of local variable is 2 Value of local variable is 3 Value of local variable is 4 Value of local variable is 5
Stay connected