Challenge: Practicing For Loop
Swipe to show menu
Task
Modify the code to display numbers from 10 to 1, one per line. Replace the placeholders (___) with the correct symbols or expressions.
index.go
12345678package main import "fmt" func main() { for i := ___; i ___ 0; ___ { fmt.Println(i) } }
Solution
package main
import "fmt"
func main() {
for i := 10; i > 0; i-- {
fmt.Println(i)
}
}
Hint
Complete the code so that it prints the numbers from 10 to 1, one number per line.
Replace the blanks (___) with the appropriate symbols or expressions.
Everything was clear?
Thanks for your feedback!
Section 3. Chapter 8
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Section 3. Chapter 8