Puzzle 23 Explanation: Go Next
Understand how id works in Go.
We'll cover the following...
We'll cover the following...
Try it yourself
Try executing the code below to see the result.
Go (1.16.5)
package mainimport ("fmt")var (id = nextID())func nextID() int {id++return id}func main() {fmt.Println(id)}
Explanation
Building the code presents the following problem:
$ go build next_id.go
#
...