Loops/Foreach: Difference between revisions
Content added Content deleted
(Replace println() with print(); replace output "syntaxhighlight" tag with "pre" tag) |
|||
Line 1,521: | Line 1,521: | ||
=={{header|J}}== |
=={{header|J}}== |
||
<syntaxhighlight lang="j"> |
<syntaxhighlight lang="j"> echo every i.10 |
||
0 |
|||
1 |
|||
2 |
|||
3 |
|||
4 |
|||
5 |
|||
6 |
|||
7 |
|||
8 |
|||
9</syntaxhighlight> |
|||
That said, J's <code>for.</code> provides a "foreach" mechanism. |
|||
<syntaxhighlight lang="J"> {{for_i. i. y do. echo i end.}}10 |
|||
0 |
|||
1 |
|||
2 |
|||
3 |
|||
4 |
|||
5 |
|||
6 |
|||
7 |
|||
8 |
|||
9 |
|||
</syntaxhighlight> |
|||
=={{header|Java}}== |
=={{header|Java}}== |