for loop - Perl programming: continue block -
i have started learning perl scripting language , have question.
in perl, logical reason having continue
block work while
, do while
loops, not for
loop?
you can use continue
block everywhere makes sense: while
, until
, foreach
loops, 'basic' blocks -- blocks aren't part of statement. note can use keyword for
instead of foreach
list iteration construct, , of course can have continue
block in case.
as else said, for (;;)
loops have continue
part -- 1 want execute first?
continue
blocks don't work do { ... } while ...
because syntactically that's different thing (do
builtin function taking block argument, , while
part statement modifier). suppose use double curly construct them (basic block inside argument block), if had to:
do { { ...; continue if $bad; ...; } continue { ...; # clean } } while $more;
Comments
Post a Comment