Loops/Foreach: Difference between revisions
Content deleted Content added
added MiniScript example |
|||
Line 1,542: | Line 1,542: | ||
{{works with|min|0.19.3}} |
{{works with|min|0.19.3}} |
||
<lang min>(1 2 3) 'puts foreach</lang> |
<lang min>(1 2 3) 'puts foreach</lang> |
||
=={{header|MiniScript}}== |
|||
<lang MiniScript>for i in collection |
|||
print i |
|||
end</lang> |
|||
The MiniScript <code>for</code> statement is always a "foreach", and the standard <code>range</code> intrinsic can be used for iteration over arithmetic sequences. All MiniScript collection types support iteration: lists iterate over each item, strings iterate over each character, and maps/objects iterate over (key,value) pairs. |
|||
=={{header|MOO}}== |
=={{header|MOO}}== |