Complete the code to print numbers from 1 to 5 using a for loop.
for (i in [1]) { println(i) }
The range 1..5 includes numbers from 1 to 5 inclusive.
Complete the code to print numbers from 1 up to but not including 5.
for (i in [1]) { println(i) }
The until operator creates a range excluding the end value, so 1 until 5 is 1, 2, 3, 4.
Fix the error in the for loop to count down from 5 to 1.
for (i in [1]) { println(i) }
The downTo function creates a decreasing range from 5 down to 1.
Fill both blanks to create a for loop that prints even numbers from 2 to 10.
for (i in [1] step [2]) { println(i) }
The range 2..10 includes numbers from 2 to 10, and step 2 makes the loop jump by 2, printing even numbers.
Fill all three blanks to create a for loop that prints numbers from 10 down to 1, stepping by 2.
for (i in [1] downTo [2] step [3]) { println(i) }
The loop starts at 10, counts down to 1 using downTo, and steps by 2 to skip every other number.