Files
learning-go-jon-bodner/chapter-2/04_unused_variables.go
2022-12-03 18:29:02 +00:00

19 lines
356 B
Go

// variables must be read at least once
// golangci-lint will warn but the compiler will allow it
// package level vars do not need to be read (another reason not to use them)
// constants do not need to be read, if they are not used they are excluded from the build
package main
import "fmt"
func main() {
x := 10
x = 20
fmt.Println(x)
x = 30
}