Ruby program to demonstrate the 'next' statement in the loop
for cnt in 1..10
if cnt == 5 then
next
end
print cnt," ";
end
Output:
1 2 3 4 6 7 8 9 10
for cnt in 1..10
if cnt == 5 then
next
end
print cnt," ";
end
Output:
1 2 3 4 6 7 8 9 10