2 ms·
He misunderstands Go const. It's not Javascript "thou shalt not re-assign this variable", Go constants are literally constants, values known at compile time, an
by yencabulator 1y ago
He misunderstands Go const. It's not Javascript "thou shalt not re-assign this variable", Go constants are literally constants, values known at compile time, and a call to strconv.Atoi isn't something that can be used in a constant expression. Think of Go constants as giving a name to a literal value, `const ANSWER = 42`, the answer now behaves exactly like writing 42 at every place of use.
https://go.dev/ref/spec#Constants https://go.dev/ref/spec#Constants
https://go.dev/ref/spec#Constant_expressions https://go.dev/ref/spec#Constant_expressions