Loops/Foreach: Difference between revisions

Content added Content deleted
(Added C3 code.)
Line 880: Line 880:
element += 42;
element += 42;
}</syntaxhighlight>
}</syntaxhighlight>

=={{header|C3}}==
C3 has a standard built-in foreach for iterating through lists.

<syntaxhighlight lang="c3">String[] fruits = { "Apple", "Banana", "Strawberry" };
foreach (fruit : fruits) io::printn(fruit);</syntaxhighlight>


=={{header|Chapel}}==
=={{header|Chapel}}==