Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Practicing For Loop | Control Structures
Introduction to Go

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

index.go

12345678
package main import "fmt" func main() { for i := ___; i ___ 0; ___ { fmt.Println(i) } }
Solution
expand arrow
package main
import "fmt"

func main() {
    for i := 10; i > 0; i-- {
        fmt.Println(i)
    }
}
Hint
expand arrow

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?

How can we improve it?

Thanks for your feedback!

Section 3. Chapter 8

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Section 3. Chapter 8
some-alt