aboutsummaryrefslogtreecommitdiff
path: root/examples/learnxiny.tm
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-09-16 16:06:19 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-09-16 16:06:19 -0400
commitde49bc5bb3198f450cb367085f9def0d89782258 (patch)
treea81354271bd3de567a7656807416cd5c69e4b08b /examples/learnxiny.tm
parent821bde156c222c7384c67517d773dc14a03342e7 (diff)
Deprecate :or_else()/:or_fail()/:or_exit() in favor of the `or` operator
Diffstat (limited to 'examples/learnxiny.tm')
-rw-r--r--examples/learnxiny.tm5
1 files changed, 2 insertions, 3 deletions
diff --git a/examples/learnxiny.tm b/examples/learnxiny.tm
index 7feca6c1..f003167f 100644
--- a/examples/learnxiny.tm
+++ b/examples/learnxiny.tm
@@ -110,12 +110,11 @@ func main():
# The value returned is optional (because the key might not be in the table).
# Optional values can be converted to regular values using `!` (which will
- # create a runtime error if the value is null) or :or_else() which uses a
- # fallback value if it's null.
+ # create a runtime error if the value is null) or the `or` operator:
>> table:get("two")!
= 2
- >> table:get("xxx"):or_else(0)
+ >> table:get("xxx") or 0
= 0
# Empty tables require specifying the key and value types: