mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-02 22:11:54 +02:00
48601/0004: docs: return: Give examples of using arithmetic evaluation.
This commit is contained in:
parent
b992d91059
commit
4202c0bbe3
2 changed files with 11 additions and 2 deletions
|
@ -1,5 +1,8 @@
|
||||||
2021-05-18 Daniel Shahaf <d.s@daniel.shahaf.name>
|
2021-05-18 Daniel Shahaf <d.s@daniel.shahaf.name>
|
||||||
|
|
||||||
|
* 48601/0004: Doc/Zsh/builtins.yo: docs: return: Give examples
|
||||||
|
of using arithmetic evaluation.
|
||||||
|
|
||||||
* 48601/0003: Doc/Zsh/builtins.yo: docs: functions -M: Add a
|
* 48601/0003: Doc/Zsh/builtins.yo: docs: functions -M: Add a
|
||||||
subheading and index entries.
|
subheading and index entries.
|
||||||
|
|
||||||
|
|
|
@ -1627,7 +1627,13 @@ cindex(functions, returning from)
|
||||||
item(tt(return) [ var(n) ])(
|
item(tt(return) [ var(n) ])(
|
||||||
Causes a shell function or `tt(.)' script to return to
|
Causes a shell function or `tt(.)' script to return to
|
||||||
the invoking script with the return status specified by
|
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
|
is omitted, the return status is that of the last command
|
||||||
executed.
|
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, the shell will behave as interrupted except that the return
|
||||||
status of the trap is retained. Note that the numeric value of the signal
|
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
|
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.
|
had not been trapped.
|
||||||
)
|
)
|
||||||
module(sched)(zsh/sched)
|
module(sched)(zsh/sched)
|
||||||
|
|
Loading…
Reference in a new issue