Programming Language

Nocter

A self-contained systems language built around simplicity, encapsulation, and foolproof design.

/development/compiler/tests/fixtures/source_corpus/valid/if-is-enum.nct

if-is-enum.nct

// Valid source-corpus fixture.
enum Color {
    red
    green
    blue
}

func main(): i32 {
    if color() is Color.red {
        return 1
    } else if color() is Color.green {
        return 2
    } else if color() is Color.blue {
        return 3
    }

    return 0
}

func color(): Color {
    return Color.green
}