diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-08-30 12:35:51 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-08-30 12:36:35 +0200 |
| commit | 3c508737d9592f54aa66a18252c15c01f867df48 (patch) | |
| tree | 798e284fb3baa5b36760e546de92da2a81549f0b /docs/reference | |
| parent | f616302496c824dd6a9fb2721c7df0c57b09708d (diff) | |
Docs for discarding a return value
Fixes #2043
Diffstat (limited to 'docs/reference')
| -rw-r--r-- | docs/reference/scripting.md | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/docs/reference/scripting.md b/docs/reference/scripting.md index de649f9a..72d2bb9a 100644 --- a/docs/reference/scripting.md +++ b/docs/reference/scripting.md @@ -264,7 +264,10 @@ types. You cannot define your own methods. ``` Methods are the only functions in Typst that can modify the value they are -called on. +called on. In some cases, this means that a method is only called for its side +effect and its return value should be ignored (and not participate in joining). +The canonical way to discard a value is with a let binding: +`{let _ = array.remove(1)}`. ## Modules { #modules } You can split up your Typst projects into multiple files called _modules._ A |
