Go theorytheory 0/50 · 0%
Fundamentals · easy

3. Variables and Constants

var, := and typed constants.

`var x int = 5` declares explicitly, while `x := 5` infers inside functions. Unused local variables are a compile error, which keeps code tidy. Constants are declared with const and untyped constants adapt to context; iota generates incrementing enum-like values.

Check your understanding

  1. 1. An unused local variable causes…

  2. 2. Which keyword generates incrementing constants?