August 2021
Beginner
112 pages
1h 23m
English
| Puzzle 4 | I’ve Got Nothing |
| | package main |
| | |
| | import ( |
| | "fmt" |
| | ) |
| | |
| | func main() { |
| | n := nil |
| | fmt.Println(n) |
| | } |
Guess the Output | |
|---|---|
|
|
Try to guess what the output is before moving to the next page. |
This code will not compile.
nil is not a type but a reserved word. A variable initialized to nil must have a type. If, for example, you change the assignment to var n *int = nil, the code will compile since now n has a type.
Here are some places ...
Read now
Unlock full access