Go iota
Go has an interesting feature called iota
. When declaring a list of constants, this keyword represents successive untyped integer constants.
Anytime const
is invoked, the counter resets.
This is a cool way to quickly define a list of integer constants, such as 'true' and 'false', for later use.
Tweet