Jump to content

Loops/Foreach: Difference between revisions

(PascalABC.NET)
Line 1,843:
=={{header|langur}}==
A for in loop iterates over values and a for of loop iterates over keys.
<syntaxhighlight lang="langur">for .i in [1, 2, 3] {
for i in [1, 2, 3] {
writeln .i
}
 
val .abc = "abc"
 
for .i in .abc {
writeln .i
}
 
for .i of .abc {
writeln .abc[.i]
}
 
for .i in .abc {
writeln cp2s .(i)
}
}</syntaxhighlight>
 
{{out}}
1,007

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.