From 5b325b99e877b4605e28bea07a2fcbd8c80e6996 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Mon, 25 Oct 2021 17:19:24 +0300 Subject: [PATCH] docs: give a concrete example of bounds access check, and error propagation with `x := arr[idx] ?` --- doc/docs.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/docs.md b/doc/docs.md index ab0f80b0f4..f94b83c229 100644 --- a/doc/docs.md +++ b/doc/docs.md @@ -1102,6 +1102,10 @@ The same optional check applies to arrays: arr := [1, 2, 3] large_index := 999 val := arr[large_index] or { panic('out of bounds') } +println(val) +// you can also do this, if you want to *propagate* the access error: +val2 := arr[333] ? +println(val2) ``` ## Module imports