diff options
Diffstat (limited to 'docs/pointers.md')
| -rw-r--r-- | docs/pointers.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/pointers.md b/docs/pointers.md index 0644a6ab..254db07e 100644 --- a/docs/pointers.md +++ b/docs/pointers.md @@ -12,7 +12,7 @@ a new, different value and assigning it to a pointer's memory location to replace the value that previously resided there. ```tomo -func no_mutation_possible(nums:[Int]): +func no_mutation_possible(nums:[Int]) nums[1] = 10 // This performs a copy-on-write and creates a new list // The new list is only accessible as a local variable here ... @@ -21,7 +21,7 @@ no_mutation_possible(my_nums) >> my_nums = [0, 1, 2] -func do_mutation(nums:@[Int]): +func do_mutation(nums:@[Int]) nums[1] = 10 // The mutates the value at the given pointer's location ... my_nums := @[0, 1, 2] @@ -82,9 +82,9 @@ this, and everywhere inside the truthy block will allow you to use the pointer as a non-null pointer: ``` -if optional: +if optional ok := optional[] -else: +else say("Oh, it was null") ``` |
