Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: A few random questions from Learning Perl 3

by jpfarmer (Pilgrim)
on Jan 06, 2003 at 04:59 UTC ( #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?

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2020-02-29 11:02 GMT
Find Nodes?
    Voting Booth?
    What numbers are you going to focus on primarily in 2020?

    Results (128 votes). Check out past polls.