aboutsummaryrefslogtreecommitdiff
path: root/examples/learnxiny.tm
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-04-06 14:20:18 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-04-06 14:20:18 -0400
commit2bb2ff871fa1761478442bec5f6a32c9428360a1 (patch)
tree9b73df7a0c50c02353ae7bca7c2cd54788ef0077 /examples/learnxiny.tm
parent59845e610f2c90474f34079d27b5f1e07071ded4 (diff)
Change method calls to use `foo.baz()` instead of `foo:baz()`
Diffstat (limited to 'examples/learnxiny.tm')
-rw-r--r--examples/learnxiny.tm16
1 files changed, 8 insertions, 8 deletions
diff --git a/examples/learnxiny.tm b/examples/learnxiny.tm
index ecb1140f..6a3b7e21 100644
--- a/examples/learnxiny.tm
+++ b/examples/learnxiny.tm
@@ -160,18 +160,18 @@ func main():
# Sets are similar to tables, but they represent an unordered collection of
# unique values:
set := {10, 20, 30}
- >> set:has(20)
+ >> set.has(20)
= yes
- >> set:has(999)
+ >> set.has(999)
= no
# You can do some operations on sets:
other_set := {30, 40, 50}
- >> set:with(other_set)
+ >> set.with(other_set)
= {10, 20, 30, 40, 50}
- >> set:without(other_set)
+ >> set.without(other_set)
= {10, 20}
- >> set:overlap(other_set)
+ >> set.overlap(other_set)
= {30}
# So far, the datastructures that have been discussed are all *immutable*,
@@ -184,7 +184,7 @@ func main():
= @[999, 20, 30]
# To call a method, you must use ":" and the name of the method:
- my_arr:sort()
+ my_arr.sort()
>> my_arr
= @[20, 30, 999]
@@ -197,7 +197,7 @@ func main():
# location. Later, a new value might end up there, but the photograph will
# remain unchanged.
snapshot := my_arr[]
- my_arr:insert(1000)
+ my_arr.insert(1000)
>> my_arr
= @[20, 30, 999, 1000]
>> snapshot
@@ -275,7 +275,7 @@ func demo_structs():
= 30
# Calling methods:
- alice:say_age()
+ alice.say_age()
# You can call static methods by using the class name and ".":
>> Person.get_cool_name()