mmcgrana / gobyexample

Go by Example
https://gobyexample.com
7.23k stars 1.27k forks source link

Go by Example: For - cannot range over X (untyped int constant) #509

Closed DiiBBz closed 8 months ago

DiiBBz commented 8 months ago

Hi!

I believe the code listed in https://gobyexample.com/for causes an error. When copy pasting the code into a main.go file and running the code by go run main.go I get two errors instead of the assumed output seen in on the left side of the code.

Output:

# command-line-arguments
./main.go:17:20: cannot range over 3 (untyped int constant)
./main.go:26:20: cannot range over 6 (untyped int constant)

Go version: go version go1.21.7 darwin/arm64

eliben commented 8 months ago

Please upgrade to Go 1.22!