Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: A few random questions from Learning Perl 3

by jpfarmer (Pilgrim)
on Jan 06, 2003 at 04:59 UTC ( [id://224546]=note: print w/replies, xml ) Need Help??


in reply to A few random questions from Learning Perl 3

3) next brings things to the bottom iteration of a loop, right? Does that mean you can't call next more than once in any given loop? If not, what happens if you need to?

Actually, it bypasses the remaining statements in the loop and goes directly to the next iteration. You can put more than one next in a loop, but once the first one is executed, the rest will be irrelevant.

However, you could do something like this:

while($runLoop){ next if ($x == $y); $x++; next if ($x == $y); print "x and y were never equal"; }

Then you could have more than one next and it make sense.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://224546]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-19 23:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found