Go iota: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 9: Line 9:


{{Internal|Go_Enumerations#Overview|Go Enumerations}}
{{Internal|Go_Enumerations#Overview|Go Enumerations}}
=How Does the Compiler Assign Values to <tt>iota</tt>==
The compiler parses <code>const()</code> sequences, and each time it encounters a <code>iota</code> constant, it assigns it the zero-based index of the constant, as it appears in the <code>const()</code> sequence.

Revision as of 19:52, 13 September 2024

External

Internal

Overview

iota is referred to as an enumerator.

Go Enumerations


How Does the Compiler Assign Values to iota=

The compiler parses const() sequences, and each time it encounters a iota constant, it assigns it the zero-based index of the constant, as it appears in the const() sequence.