in reply to Re^4: Regexp to extract groups of numbers
in thread Regexp to extract groups of numbers
And while loops are just gotos in disguise. Pretty much anyway.
While i posted somewhat tongue-in-cheek im curious: Is that really true in perl?
and somewhere in the block, we have the increment of the variant.
I suppose you could code it that way, but you can also use a continue block:
while (EXPR) { } continue { STMTS; }
Which can be useful at times and is pretty much what Perl does anyway. Ie:
for(INIT;EXPR;INCR) { STMTS; }
more or less becomes:
{ INIT; while (EXPR) { STMTS; } continue { INCR; } }
I think how much value you place on your second point will vary depending on your exposure to C and other C like languages. Personally I always hated 3 arg for loops finding them difficult to read, but lately ive been doing a lot of C and have come to appreciate them a lot more (probably becuase I find reading them not to be so confusing as it used to be).
Anyway, i stuck the smiley face on there for a reason. I just thought the fact that the two constructs are identical in perl (insofar as perl converts 3arg for loops into while continue constructs anyway) made your comment a touch ironic. :-)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^6: Regexp to extract groups of numbers
by halley (Prior) on Feb 07, 2005 at 21:28 UTC |