booleans, comparisons, and if/else
This commit is contained in:
@@ -81,10 +81,14 @@
|
||||
- static inline functions (implemented)
|
||||
|
||||
- 5. control flow
|
||||
- boolean expressions
|
||||
- boolean expressions (implemented)
|
||||
- `bool` type with `true` / `false` literals
|
||||
- comparison operators: `==`, `!=`, `<`, `<=`, `>`, `>=` (numeric operands widen; `bool` supports only `==` / `!=`)
|
||||
- operators: `and`, `or`, `!`
|
||||
- lazy evaluation / short-circuit evaluation
|
||||
- if statements. example: `if condition { ... } else if { ... } else { ... }`
|
||||
- if statements (implemented). example: `if condition { ... } else if { ... } else { ... }`
|
||||
- conditions must be `bool`; block-scoped locals with shadowing across blocks
|
||||
- lowered through new `Label` / `Br` / `Cond_Br` IR opcodes (alloca-backed locals, no phi nodes)
|
||||
- conditional unwrapping for optionals (`?T`): `if val |v| { ... } else { ... }` - unwrap `val` into `v` if it is not `none`
|
||||
- conditional unwrapping with guard clause: `if val |v : v >= 10| { ... } else { ... }` - unwrap `val` into `v` if it is not `none`
|
||||
- multi-unwrap (see section below)
|
||||
|
||||
Reference in New Issue
Block a user