Ralph Corderoy wrote in
<20230311112508.7306220145(a)orac.inputplus.co.uk>:
|Hi Steffen,
|
|COFF'd.
|
|> Very often i find myself needing a restart necessity, so "continue
|> N" would that be. Then again when "N" is a number instead of
|> a label this is a (let alone maintainance) mess but for shortest
|> code paths.
|
|Do you mean ‘continue’ which re-tests the condition or more like Perl's
|‘redo’ which re-starts the loop's body?
No Ralph, i unspecifically meant multiple nested loops where some
inner has to restart/continue the outer (at some point).
So a bit like that of "man perlsyn", but with deeper nesting
If you need both "next" and "last", you have to do both and
also use a
loop label:
LOOP: {
do {{
next if $x == $y;
last LOOP if $x == $y**2;
# do something here
}} until $x++ > $z;
}
--steffen
|
|Der Kragenbaer, The moon bear,
|der holt sich munter he cheerfully and one by one
|einen nach dem anderen runter wa.ks himself off
|(By Robert Gernhardt)