The foreach loop iterates over a normal list value and sets the variable VAR to be each element of the list in turn.It is directly aliased. If you modify the element that you are iterating over, you modify the elements of the array, if you modify the elements of the array you modify the element that you are iterating over, and if you create a closure that temporary aliasing becomes longer-lived.
In reply to RE (tilly) 5 (closures): for loops
by tilly
in thread for loops, closures
by Aighearach
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |