Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: for loops

by TedPride (Priest)
on Oct 11, 2004 at 20:07 UTC ( #398278=note: print w/replies, xml ) Need Help??


in reply to Re: for loops
in thread for loops

Mmm. For allows you control of the looping variable, which means you can make it skip backwards and forwards:
for ($i = 0; $i < 40; $i++) { $i += 10 if (@arr[$i] eq 'jump'); }
However, foreach covers pretty much every other situation. I haven't used for in quite some time now.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2020-05-29 01:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (166 votes). Check out past polls.

    Notices?