diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-04-06 22:45:02 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-04-06 22:45:02 -0400 |
| commit | 44cd26f2cebd760a53aa4ff1b7779e718a101650 (patch) | |
| tree | 4bdc9144c6825a0c394155712d5e464ee2a61061 /examples/learnxiny.tm | |
| parent | 3406515a44b13d0c290c28ac42bd364ce27560c7 (diff) | |
Rename Array -> List in all code and docs
Diffstat (limited to 'examples/learnxiny.tm')
| -rw-r--r-- | examples/learnxiny.tm | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/examples/learnxiny.tm b/examples/learnxiny.tm index b8eaa77e..9b9f1017 100644 --- a/examples/learnxiny.tm +++ b/examples/learnxiny.tm @@ -52,23 +52,23 @@ func main() else say("else") - # Arrays: + # Lists: my_numbers := [10, 20, 30] - # Empty arrays require specifying the type: - empty_array : [Int] - >> empty_array.length + # Empty lists require specifying the type: + empty_list : [Int] + >> empty_list.length = 0 - # Arrays are 1-indexed, so the first element is at index 1: + # Lists are 1-indexed, so the first element is at index 1: >> my_numbers[1] = 10 - # Negative indices can be used to get items from the back of the array: + # Negative indices can be used to get items from the back of the list: >> my_numbers[-1] = 30 - # If an invalid index outside the array's bounds is used (e.g. + # If an invalid index outside the list's bounds is used (e.g. # my_numbers[999]), an error message will be printed and the program will # exit. @@ -80,7 +80,7 @@ func main() for index, num in my_numbers pass # Pass means "do nothing" - # Arrays can be created with array comprehensions, which are loops: + # Lists can be created with list comprehensions, which are loops: >> [x*10 for x in my_numbers] = [100, 200, 300] >> [x*10 for x in my_numbers if x != 20] @@ -132,7 +132,7 @@ func main() pass # Tables also have ".keys" and ".values" fields to explicitly access the - # array of keys or values in the table. + # list of keys or values in the table. >> table.keys = ["one", "two"] >> table.values @@ -153,7 +153,7 @@ func main() # If no default is provided and a missing key is looked up, the program # will print an error message and halt. - # Any types can be used in tables, for example, a table mapping arrays to + # Any types can be used in tables, for example, a table mapping lists to # strings: table3 := {[10, 20]="one", [30, 40, 50]="two"} >> table3[[10, 20]]! @@ -241,10 +241,10 @@ func takes_many_types( integer:Int, floating_point_number:Num, text_aka_string:Text, - array_of_ints:[Int], + list_of_ints:[Int], table_of_text_to_bools:{Text=Bool}, set_of_ints:|Int|, - pointer_to_mutable_array_of_ints:@[Int], + pointer_to_mutable_list_of_ints:@[Int], optional_int:Int?, function_from_int_to_text:func(x:Int -> Text), ) |
