aboutsummaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rw-r--r--api/pointers.md3
1 files changed, 2 insertions, 1 deletions
diff --git a/api/pointers.md b/api/pointers.md
index 4258c329..ee7a5d8f 100644
--- a/api/pointers.md
+++ b/api/pointers.md
@@ -18,6 +18,7 @@ replace the value that previously resided there.
```tomo
func no_mutation_possible(nums:[Int]):
nums[1] = 10 // This performs a copy-on-write and creates a new array
+ // The new array is only accessible as a local variable here
...
my_nums := [0, 1, 2]
no_mutation_possible(my_nums)
@@ -30,7 +31,7 @@ func do_mutation(nums:@[Int]):
my_nums := @[0, 1, 2]
do_mutation(my_nums)
>> my_nums
-= [10, 1, 2]
+= @[10, 1, 2]
```
In general, heap pointers can be used as stack pointers if necessary, since