in reply to Re: while(){}continue{}; Useful?
in thread while(){}continue{}; Useful?
Hm. Seems to me that
my $n = 10; while( $n ){ print $n--; next if $n%2; ## do other stuff here } continue{ sleep 1; }
Is exactly equivalent to:
my $n = 10; while( $n ){ print $n--; unless( $n%2 ) { ## do other stuff here } sleep 1; }
And far clearer. (Even if you prefer the if( not $n%2 ) form.)
There has to be a good use for it, I'm just not seeing it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: while(){}continue{}; Useful?
by kennethk (Abbot) on Mar 03, 2010 at 18:07 UTC | |
by BrowserUk (Patriarch) on Mar 03, 2010 at 20:38 UTC | |
by kennethk (Abbot) on Apr 05, 2010 at 17:09 UTC | |
by BrowserUk (Patriarch) on Apr 05, 2010 at 19:23 UTC | |
by kennethk (Abbot) on Apr 05, 2010 at 22:54 UTC | |
|