|
|
| Perl-Sensitive Sunglasses | |
| PerlMonks |
Re: difference between for and foreach?by merlyn (Sage) |
| on Jan 20, 2001 at 18:12 UTC ( [id://53241]=note: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.
The words for and foreach are interchangable, syntactically.
(This is what most people are saying when they say there's "no difference").
However, as Larry intended it, there's a "for" statement, with 3 parts, like C's same-named, and a "foreach" statement, like csh's same-named loop. And they do nicely different things, even though they're both basically loops. So, yes, there's a difference, except when there's not a difference. If you check the Llama, we're very careful to describe the two kinds of loops seperately. They have different uses and syntax. -- Randal L. Schwartz, Perl hacker
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||