Qu

enum_values

Builtin index · Collections & strings

result = enum_values(EnumType)

Input: EnumType · Output: result

What it is

EnumType is a type declared with enum ... end (not a string — the bare type name).

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = enum_values(EnumType)
EnumType stringnot documented yet
result List
Returns a List of EnumVals: every variant of the declared type, in declaration order — makes the type a real enumeration rather than just a handful of named constants, and lets code iterate "all seasons" without hardcoding the list a second time.

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

enum Season
    Spring, Summer, Autumn, Winter
end

seasons = enum_values(Season)
for i = 0 to length(seasons) - 1
    print(seasons[i])
end for
output
Spring
Summer
Autumn
Winter

from collections-strings

How it works

enum_values(Season) (§ enum, 2026-08-24) — the piece that makes an enum a real *enumeration* rather than just a handful of named constants: takes the bare Value::EnumType reference (Season, resolved by Expr::Name's fallback) and returns every one of its variants, as a Value::EnumVal each, in declaration order — a plain List, so a script can for v in enum_values(Season) with no special-cased loop construct needed.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.