Ruby Next statement
Ruby Next statement
The Ruby Next statement is used to skip the rest of the current iteration.
Next Statement syntax
next
Next Statement example
for x in 1..5 if x < 4 then next end puts "The value of x = #{x}" end
Output
The value of x = 4
The value of x = 5