Loops/Foreach: Difference between revisions
Content added Content deleted
(Added Kotlin) |
|||
Line 1,211: | Line 1,211: | ||
In both cases, the result is the stream of values: "a", "b", "c". |
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}}== |
=={{header|Lasso}}== |