Challenge: Constants
Task
Declare and initialize a constant called myConst with a value of 17.
index.go
1234567package main import "fmt" func main() { ___ fmt.Println(myConst) // Should output 17 }
- Use the
constkeyword for constants. - Assign the value directly when declaring.
- The name should be
myConstand the value 17.
package main
import "fmt"
func main() {
const myConst = 17
fmt.Println(myConst) // Should output 17
}
Everything was clear?
Thanks for your feedback!
SectionΒ 1. ChapterΒ 11
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Suggested prompts:
Can you explain why we use the `const` keyword here?
What happens if I try to change the value of `myConst` later in the code?
Can you show how to print the value of `myConst`?
Awesome!
Completion rate improved to 1.96
Challenge: Constants
Swipe to show menu
Task
Declare and initialize a constant called myConst with a value of 17.
index.go
1234567package main import "fmt" func main() { ___ fmt.Println(myConst) // Should output 17 }
- Use the
constkeyword for constants. - Assign the value directly when declaring.
- The name should be
myConstand the value 17.
package main
import "fmt"
func main() {
const myConst = 17
fmt.Println(myConst) // Should output 17
}
Everything was clear?
Thanks for your feedback!
SectionΒ 1. ChapterΒ 11