aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--learnxiny.tm8
1 files changed, 8 insertions, 0 deletions
diff --git a/learnxiny.tm b/learnxiny.tm
index fcf25688..91590206 100644
--- a/learnxiny.tm
+++ b/learnxiny.tm
@@ -58,6 +58,11 @@ func main():
# Arrays:
my_numbers := [10, 20, 30]
+ # Empty arrays require specifying the type:
+ empty := [:Int]
+ >> empty.length
+ = 0
+
# Arrays are 1-indexed, so the first element is at index 1:
>> my_numbers[1]
= 10
@@ -110,6 +115,9 @@ func main():
# Otherwise, a runtime error will be raised:
# >> table:get("xxx")
+ # Empty tables require specifying the key and value types:
+ empty := {:Text:Int}
+
# Tables can be iterated over either by key or key,value:
for key in table:
pass