🐹 Go (Golang)
Beginner
What are zero values in Go?
Answer
In Go, every variable is automatically initialized to its zero value if no explicit value is given — there is no concept of an "uninitialized" variable. Zero values by type: int → 0, float64 → 0.0, bool → false, string → "" (empty string), pointers/maps/slices/channels/functions → nil, structs → each field set to its own zero value. This guarantee eliminates entire classes of bugs caused by reading uninitialized memory and is a deliberate, principled design decision in Go.
Previous
What is the difference between GOPATH and Go modules?
Next
What is a type declaration in Go?