Enumerations
enum Color { Red = 1, Blue, Green }
- Explicit discriminator type ? —
enum Color: int32 { ... }
- Scope; is
Red a name or must it be accessed via Color.Red ?
Switch / Match
From C this is the switch value { ... } statement.
match value {
case 1 { do_1(); }
case 2 { do_2(); }
case 3 {
do_3();
do_31();
}
otherwise {
do_else();
}
}
- How far do we go with case patterns?
otherwise, case _, _, else, or default for the "else" arm
- General case syntax:
case pattern => { ... }
case pattern { ... }
pattern => { ... }