diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-08-18 21:24:21 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-08-18 21:24:21 -0400 |
| commit | 19c51194f0b2ad945bfb7b544032210274b431dd (patch) | |
| tree | 14e1ebc0aed242a18b1391e60639aaa1a2bc3478 | |
| parent | 3fbd242ea335b58e05cdce775d0d170384c84078 (diff) | |
Update docs
| -rw-r--r-- | api/pointers.md | 3 |
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 |
