October 2018
Intermediate to advanced
370 pages
9h 15m
English
A for loop within a for loop is called a nested for loop. The outer for loop will assign a value from range to i, and the inner for loop will assign a value from range to j, and both values will be printed in the inner for loop:
for (i in 1..3) { for (j in 1..3) { println("$i , $j") }}
Notice that on each iteration of the outer for loop, the inner for loop will be executed three times.
Read now
Unlock full access