diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-04-06 15:09:44 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-04-06 15:09:44 -0400 |
| commit | 448e805293989b06e07878a4a87fdd378f7c6e02 (patch) | |
| tree | d0364efbeaad0eeb863593c26745d64deaf4a212 /test/when.tm | |
| parent | 4043a99e0df9fab6791c485721c0046971754175 (diff) | |
Re-implement multiple patterns for `when` blocks
Diffstat (limited to 'test/when.tm')
| -rw-r--r-- | test/when.tm | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/test/when.tm b/test/when.tm index 77c97af5..d93745dd 100644 --- a/test/when.tm +++ b/test/when.tm @@ -1,13 +1,18 @@ # Tests for the 'when' block func main(): - str := "B" - when str is "A": - fail("First") - is "B": - say("Success") - is "C": - fail("Third") + answers := [ + ( + when x is "A","B": + "A or B" + is "C": + "C" + else: + "Other" + ) for x in ["A", "B", "C", "D"] + ] + >> answers + = ["A or B", "A or B", "C", "Other"] n := 23 >> when n is 1: Int64(1) |
