Pętla "foreach"
foreach x collection [instructions]
Repeat list of instructions using successive elements of collection assigned to a variable named
with the result of x expression. Collection can be a list,
an an array or a dictionary.
Each element of a dictionary is represented during the loop with an array {keyword value}
.
Example 1:
foreach "x {1 2 3} [print :x * :x]
Output:
1
4
9
Example 2:
foreach "p :pool_inf [print :p]
Output:
{wall_mode wrap}
{turtles_count 1}
{current_fps 0}
{wall_left -396}
{wall_right 396}
{wall_top 195}
{wall_bottom -195}
{image_width 792}
{image_height 390}
See also:
Loop instructions
Table of Content