From 3c508737d9592f54aa66a18252c15c01f867df48 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Wed, 30 Aug 2023 12:35:51 +0200 Subject: [PATCH] Docs for discarding a return value Fixes #2043 --- docs/reference/scripting.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/reference/scripting.md b/docs/reference/scripting.md index de649f9af..72d2bb9a6 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