Tsallaka zuwa abun ciki
Justice Tech School

for Loops

for walks any iterable. Ranges use .., until, downTo and step.

Example
for (i in 1..3) print("$i ")
println()
for (i in 10 downTo 1 step 3) print("$i ")
println()
for (i in 0 until 3) print("$i ")
println()

Exercise

Exclude the end.

0  3

Quiz Test

Does 1..3 include 3?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.