Jump to content

Loops/Foreach: Difference between revisions

Added Kotlin
(Added Kotlin)
Line 1,211:
 
In both cases, the result is the stream of values: "a", "b", "c".
 
=={{header|Kotlin}}==
<lang scala>// version 1.0.6
 
fun main(args: Array<String>) {
val greek = arrayOf("alpha", "beta", "gamma", "delta")
for (letter in greek) print("$letter ")
println()
// or alternatively
greek.forEach { print("$it ") }
println()
}</lang>
 
{{out}}
<pre>
alpha beta gamma delta
alpha beta gamma delta
</pre>
 
=={{header|Lasso}}==
9,490

edits

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