Complete the code to print numbers from 1 to 5 using a for loop.
for i := 1; i <= [1]; i++ { fmt.Println(i) }
The loop should run until i is less than or equal to 5 to print numbers 1 to 5.
Complete the code to skip printing the number 3 inside the loop.
for i := 1; i <= 5; i++ { if i == [1] { continue } fmt.Println(i) }
The continue statement skips the current iteration when i equals 3, so 3 is not printed.
Fix the error in the loop to stop printing numbers when i equals 4.
for i := 1; i <= 5; i++ { if i == [1] { break } fmt.Println(i) }
The break statement stops the loop when i equals 4, so numbers 1 to 3 are printed.
Fill both blanks to create a loop that prints even numbers from 2 to 10.
for i := [1]; i <= 10; i += [2] { fmt.Println(i) }
Start from 2 and increase i by 2 each time to print even numbers from 2 to 10.
Fill all three blanks to create a loop that prints numbers from 10 down to 1.
for i := [1]; i [2] 1; i [3] { fmt.Println(i) }
The loop starts at 10, continues while i is greater than or equal to 1, and decreases i by 1 each time.