Files
sakurac/tests/programs/enums_and_match_values_2.sakura
T
2026-12-06 13:52:57 -06:00

9 lines
413 B
Plaintext

import std::io;
enum word: u8 { a, b, c, first = word::a, last = word::c }
enum next: u8 { start = word::last, d, e, stop = next::e }
def name(w: word): int { return match w { first => 1, b => 2, last => 3 }; }
def main(): void {
println($"{word::first} {word::last as u8} {word::first == word::a} {2 as word}");
println($"{next::start as u8} {next::d as u8} {next::stop} {name(word::c)} {name(word::a)}");
}