| 1 | import term |
| 2 | |
| 3 | const color = $if windows { |
| 4 | term.bright_cyan('WINDOWS') |
| 5 | } $else { |
| 6 | term.bright_green('UNIX') |
| 7 | } |
| 8 | |
| 9 | fn test_const_from_comptime_if_expr() { |
| 10 | salutation := 'hello' |
| 11 | val := match salutation { |
| 12 | 'hello' { color + ' some text' } |
| 13 | 'goodbyte' { color + ' some other text' } |
| 14 | else { 'invalid' } |
| 15 | } |
| 16 | |
| 17 | println(val) |
| 18 | assert true |
| 19 | } |
| 20 |