Anonymous user
Loops/Foreach: Difference between revisions
→{{header|Swift}}
m (→{{header|LFE}}: Updated to more recent syntax) |
|||
Line 1,692:
=={{header|Swift}}==
<lang swift>for i in [1,2,3] {
}</lang>
This works for any type that conforms to the <code>
Alternately:
{{works with|Swift|2.x+}}
<lang swift>[1,2,3].forEach {
print($0)
}</lang>
▲This works for any type that conforms to the <code>Sequence</code> protocol (including arrays, collections, generators, ranges, and strings).
=={{header|SystemVerilog}}==
|