diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-09-13 12:01:52 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-09-13 12:01:52 -0400 |
| commit | 981da7f0c6c47f66120482e7a7885cb5719d6959 (patch) | |
| tree | c0d5bf912e7e477a0486120b8ac4aea8c49833f9 /docs | |
| parent | 3a8841af6d15763e4c322c2c7671582ed6c3b006 (diff) | |
| parent | b4f2d03db2cd20688d6bb537904998e997bc48aa (diff) | |
Merge branch 'optional-list-indexing' into dev
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/lists.md | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/docs/lists.md b/docs/lists.md index dfb64aad..d12a0b5b 100644 --- a/docs/lists.md +++ b/docs/lists.md @@ -62,24 +62,23 @@ last item, `-2` is the second-to-last, and so on. ```tomo list := [10, 20, 30, 40] >> list[1] -= 10 += 10? >> list[2] -= 20 += 20? + +>> list[999] += none >> list[-1] -= 40 += 40? >> list[-2] -= 30 += 30? ``` If a list index of `0` or any value larger than the length of the list is -used, it will trigger a runtime error that will print what the invalid list -index was, the length of the list, and a stack trace. As a performance -operation, if list bounds checking proves to be a performance hot spot, you -can explicitly disable bounds checking by adding `list[i; unchecked]` to the -list access. +used, a `none` value will be returned. ## Iteration |
