Source
Edit
- new scopes are introduced immediately aftered the keywords (e.g. if, elif, etc)
- except for when statements/expressions
- use whens for completely removing sections of code at compile time
- all can be used as expressions and the result assigned to a var
- case statement branches should be listed in order of most expected
- likely
- unlikely
- an example of using when (and if?) inside an object constructor
- a compile time if statement
- the condition MUST be a constant expression
- does not open a new scope
- only the first truthy value is compiled
- similar to if, but represents a multi-branch selection
- supports strings, ordinal types and integers
- ints/ordinals can also use ranges
- the of part must match the value type
- can also use elif, else branches
checks whether x can be compiled without any semantic error. useful to verify whether a type supports some operation:whether x is declared at compile timechecks current scope at compile time