unless guards in case statements

This commit is contained in:
2021-12-30 12:58:58 -07:00
parent 9a2e9093a1
commit 5c4927f908
2 changed files with 12 additions and 2 deletions

View File

@@ -369,6 +369,10 @@
((when false (or 5 6)) (Assert.fail))
((when true (or 7 8 9)) (Assert.fail))
(otherwise (Assert.pass)))
(case 5
((unless true (or 5 6)) (Assert.fail))
((unless false (or 7 8 9)) (Assert.fail))
(otherwise (Assert.pass)))
// In Haxe,
// `switch (Some(true)) { case Some(true | false): "a"; default: "b"; }`
// returns "a", so nested use of `or` in case patterns should also be valid: