1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-03 10:21:46 +02:00

52549: document return works in a script

This commit is contained in:
Peter Stephenson 2024-02-19 11:10:04 +00:00
parent d2f63d0d92
commit a6ea122867
2 changed files with 9 additions and 2 deletions

View file

@ -1,4 +1,9 @@
2024-02-19 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> 2024-02-19 Peter Stephenson <p.w.stephenson@ntlworld.com>
* 52549: Doc/Zsh/builtins.yo: document that return already works
in a script.
x2024-02-19 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
* 52544: Completion/Unix/Type/_diff_options: support macOS Ventura * 52544: Completion/Unix/Type/_diff_options: support macOS Ventura
or newer or newer

View file

@ -1649,7 +1649,9 @@ 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). an arithmetic expression var(n). Also causes a non-interctive
shell to exit, allowing files containing shell code to be used
both as scripts and as autoloadable shell functions.
For example, the following prints `tt(42)': For example, the following prints `tt(42)':
example(() { integer foo=40; return "foo + 2" } example(() { integer foo=40; return "foo + 2" }