From 19c51194f0b2ad945bfb7b544032210274b431dd Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 18 Aug 2024 21:24:21 -0400 Subject: Update docs --- api/pointers.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'api') 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 -- cgit v1.2.3