Loops/Foreach: Difference between revisions

Content added Content deleted
(Added EchoLisp)
Line 1,413: Line 1,413:
Perl 6 leaves off the <tt>each</tt> from <tt>foreach</tt>, leaving us with <tt>for</tt> instead. The variable <tt>$_</tt> refers to the current element, unless you assign a name to it using <tt>-></tt>.
Perl 6 leaves off the <tt>each</tt> from <tt>foreach</tt>, leaving us with <tt>for</tt> instead. The variable <tt>$_</tt> refers to the current element, unless you assign a name to it using <tt>-></tt>.
<lang perl6>for @collection -> $currentElement { say $currentElement; }</lang>
<lang perl6>for @collection -> $currentElement { say $currentElement; }</lang>

=={{header|Phix}}==
<lang Phix>sequence s = {-2,"field",3.14159268979,{"this","that"}}
for i=1 to length(s) do
?s[i]
end for</lang>


=={{header|PHL}}==
=={{header|PHL}}==