Programming Language

Nocter

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

/development/compiler/tests/fixtures/source_corpus/valid/match-enum.nct

match-enum.nct

// Valid source-corpus fixture.
enum AppError {
    missing_path
    open_failed(path: &str)
}

func main(): i32 {
    return describe(AppError.missing_path)
}

func describe(error: AppError): i32 {
    match error {
        AppError.missing_path {
            return 0
        }

        AppError.open_failed(path) {
            use_path(path)
            return 1
        }
    }

    return 2
}

func use_path(path: &str): void {
    return
}