nbuilding/N-lang

Allow `match` to deconstruct enum values

Ashvin-Ranjan opened this issue · 0 comments

This will help with enums as the only way to deconstruct one currently is if let, but with match it can be a lot cleaner:

match maybe_value {
    yes(val) -> print(val)
    none -> print("None")
}

instead of

if let yes(val) = maybe_value {
    print(val)
} else {
    print("None")
}