Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Comments in Go | Getting Started
Introduction to GoLang

bookChallenge: Comments in Go

Task

Comment out the statement that should be shown and uncomment the statement that needs to be shown in the following code.

index.go

index.go

copy
1234567
package main import "fmt" func main() { fmt.Println("This sentence should not be outputted") //fmt.Println("This sentence should be outputted") }
  1. Use // to comment out a line in Go.
  2. You need to hide the first print statement.
  3. Then remove // from the second one to display it.
package main
import "fmt"

func main() {
    //fmt.Println("This sentence should not be outputted")
    fmt.Println("This sentence should be outputted")
}
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 1. ChapterΒ 9

Ask AI

expand

Ask AI

ChatGPT

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

Suggested prompts:

Can you explain why we need to comment out the first print statement?

What does the output look like after making these changes?

Can you show me how to comment and uncomment lines in other programming languages?

Awesome!

Completion rate improved to 1.96

bookChallenge: Comments in Go

Swipe to show menu

Task

Comment out the statement that should be shown and uncomment the statement that needs to be shown in the following code.

index.go

index.go

copy
1234567
package main import "fmt" func main() { fmt.Println("This sentence should not be outputted") //fmt.Println("This sentence should be outputted") }
  1. Use // to comment out a line in Go.
  2. You need to hide the first print statement.
  3. Then remove // from the second one to display it.
package main
import "fmt"

func main() {
    //fmt.Println("This sentence should not be outputted")
    fmt.Println("This sentence should be outputted")
}
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 1. ChapterΒ 9
some-alt