aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/pointers.md9
1 files changed, 5 insertions, 4 deletions
diff --git a/docs/pointers.md b/docs/pointers.md
index ee7a5d8f..b1d0fc19 100644
--- a/docs/pointers.md
+++ b/docs/pointers.md
@@ -101,12 +101,13 @@ optional := &foo?
```
The compiler will not allow you to dereference an optionally null pointer
-without explicitly checking for null. To do so, use pattern matching like
-this:
+without explicitly checking for null. To do so, use a conditional check like
+this, and everywhere inside the truthy block will allow you to use the pointer
+as a non-null pointer:
```
-when optional is @ptr:
- ok := ptr[]
+if optional:
+ ok := optional[]
else:
say("Oh, it was null")
```