in reply to Do/while correct answer loop
This way you can name the loop (for multiple break-outs). If you want next OUTERLOOP to work, you merely next to add additional continue block:{ stuff more stuff last if $cond; # middle exit still more stuff again more stuff redo if $cond; # repeat as long as $cond is true }
Naked blocks are fun!OUTERLOOP: { blah while ($foo) { blah next OUTERLOOP if $cond; blah } blah } continue { redo if $cond; }
-- Randal L. Schwartz, Perl hacker
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: Do/while correct answer loop
by turnstep (Parson) on May 12, 2000 at 19:54 UTC |