But for purposes of documentation, we call a for loop the thing that acts very C-like (with three expressions separated by semicolons), and foreach is reserved for the csh-like thing (with a variable to walk through a list).
In my experience, people start out writing a lot of for-loops, but end up writing many more foreach loops. Of course, people spell it "f-o-r" and pronounce it "foreach".
-- Randal L. Schwartz, Perl hacker
In reply to RE: Re: for vs foreach
by merlyn
in thread for vs foreach
by vkonovalov
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |