aboutsummaryrefslogtreecommitdiff
path: root/Doc
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2021-04-16 18:04:13 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2021-05-18 02:01:13 +0000
commit4202c0bbe35fbdc2c93b4bfe97dfe52db1b0331e (patch)
tree5ec3fa6743c795f1f0d73c7b9389fd723dd85aa0 /Doc
parentb992d91059b0a6bf2da7519aafcab9dff865498c (diff)
downloadzsh-4202c0bbe35fbdc2c93b4bfe97dfe52db1b0331e.tar.gz
zsh-4202c0bbe35fbdc2c93b4bfe97dfe52db1b0331e.tar.xz
zsh-4202c0bbe35fbdc2c93b4bfe97dfe52db1b0331e.zip
48601/0004: docs: return: Give examples of using arithmetic evaluation.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/Zsh/builtins.yo10
1 files changed, 8 insertions, 2 deletions
diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index 0129c6b57..f8e11d79d 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -1627,7 +1627,13 @@ cindex(functions, returning from)
item(tt(return) [ var(n) ])(
Causes a shell function or `tt(.)' script to return to
the invoking script with the return status specified by
-an arithmetic expression var(n). If var(n)
+an arithmetic expression var(n).
+For example, the following prints `tt(42)':
+
+example(() { integer foo=40; return "foo + 2" }
+echo $?)
+
+If var(n)
is omitted, the return status is that of the last command
executed.
@@ -1638,7 +1644,7 @@ will return to whatever it was previously processing; with a non-zero
status, the shell will behave as interrupted except that the return
status of the trap is retained. Note that the numeric value of the signal
which caused the trap is passed as the first argument, so the statement
-`tt(return $((128PLUS()$1)))' will return the same status as if the signal
+`tt(return "128PLUS()$1")' will return the same status as if the signal
had not been trapped.
)
module(sched)(zsh/sched)