Go iota: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 13: Line 13:
=How Does the Compiler Assign Values to <tt>iota</tt>=
=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.
The compiler parses <code>const()</code> sequence, 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() sequence, 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.