20,741
edits
m (→A hash based version (recommended): foreach index expression not an lvalue) |
mNo edit summary |
||
Line 81: | Line 81: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
The same thing can be accomplished using the forindex loop: | |||
<syntaxhighlight lang="php"> | |||
var waypoints = ["wp1","wp2","wp3","wp4","wp5"]; | |||
forindex(index; waypoints) { | |||
print(waypoints[index]); | |||
} | |||
</syntaxhighlight> | |||
Now, waypoints being a vector, we can also use a simple foreach loop, that works without a counter, to process each element easily: | Now, waypoints being a vector, we can also use a simple foreach loop, that works without a counter, to process each element easily: |