aboutsummaryrefslogtreecommitdiff
path: root/test/optionals.tm
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-09-11 23:17:03 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-09-11 23:17:03 -0400
commitc034175ae1cbe53bc0e7e1ae71b51c64dcc3402a (patch)
tree8a6b1754c7530399a563d7b80a669d6d08d8af37 /test/optionals.tm
parentcfef667a899339a0fd5b79214d581db6ede10748 (diff)
Add optional:or_else(fallback) and optional:or_fail(message)
Diffstat (limited to 'test/optionals.tm')
-rw-r--r--test/optionals.tm9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/optionals.tm b/test/optionals.tm
index e2cdf9a6..26e825ae 100644
--- a/test/optionals.tm
+++ b/test/optionals.tm
@@ -83,6 +83,15 @@ func main():
5
= 5? : Int?
+ >> (5?):or_else(-1)
+ = 5 : Int
+
+ >> (5?):or_fail()
+ = 5 : Int
+
+ >> (!Int):or_else(-1)
+ = -1 : Int
+
do:
!! Ints:
>> yep := maybe_int(yes)