G
GGarramuno
1) Is there anything like Perl's continue block available? This is
not next, but a block that gets executed on each loop, before the
condition is tested, similar to the third block of a for loop does.
Ex:
i = 10
while i > 0
# do stuff
x = rand
if x > 0.5 next
p "not always get here"
continue
i -= 1
end
In the above example, i -= 1 gets executed at the end of the while
loop or if next is called.
2) Is there anything like labels for iterators or loops? This allows
you to do next, last, etc. on outside loops, like:
loop1: while x > 1
while y > 1
if t2 then next loop1
end
end
This could be emulated with a flag and an ugly if check, but I hope
not.
not next, but a block that gets executed on each loop, before the
condition is tested, similar to the third block of a for loop does.
Ex:
i = 10
while i > 0
# do stuff
x = rand
if x > 0.5 next
p "not always get here"
continue
i -= 1
end
In the above example, i -= 1 gets executed at the end of the while
loop or if next is called.
2) Is there anything like labels for iterators or loops? This allows
you to do next, last, etc. on outside loops, like:
loop1: while x > 1
while y > 1
if t2 then next loop1
end
end
This could be emulated with a flag and an ugly if check, but I hope
not.