Inside functions, use the short declaration operator := (infers type automatically). Variables declared with var without an initial value get safe Zero Values (0 for numbers, false for bool, "" for string)—never uninitialized garbage!
Note: Unused local variables are a compile error in Go, keeping code tidy.
ADVERTISEMENT