Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: If I was forced to use only one kind of loop for the rest of my days it would be a

by arc_of_descent (Hermit)
on Oct 03, 2005 at 03:16 UTC ( #496810=note: print w/replies, xml ) Need Help??


in reply to If I was forced to use only one kind of loop for the rest of my days it would be a

Definitely a foreach over a for

Wouldn't want to be stuck with a $_ in my loops now for the rest of my life. I prefer a meaningful name for the it variable

  • Comment on Re: If I was forced to use only one kind of loop for the rest of my days it would be a

Replies are listed 'Best First'.
Re^2: If I was forced to use only one kind of loop for the rest of my days it would be a
by Moron (Curate) on Oct 04, 2005 at 11:25 UTC
    (Updated) I rather feel some people would regret their choices. Only recursion can replace all the others, although I voted for for, because recursion is not technically a loop and in many replacement scenarios it would need some horrible overworking to overcome certain scoping issues, but for has enough machinery to replace everything else except recursion. For example, while (condition) is functionally the same as for (;condition;) and do {} while (condition) could be replaced by for (my $first = 1; $first or condition; $first=0) {}

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://496810]
help
Chatterbox?
[Corion]: marto: Ow, I hope that gets better soonish! But I feel some $work-timecrunch looming at my $work as well
[Corion]: marto: Ah, so you can multiplex work and PM time ;-D
[Corion]: The upside to this is that I've reduced my $work (well, $paid) time to 80%, so I'll be at $work only four days/week, which will hopefully make the crunch less crunchy on me ;)
[marto]: yeah, so that stays as before. But before the boys were born I'd be on quite often at night (GMT) also
[marto]: I had the option during our TUPE transfer to buy 5 more days holiday. They were shocked when I did :P

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2017-06-29 08:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (655 votes). Check out past polls.