From a6ea12286709273e7896916dc8a107cd52f01d26 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 19 Feb 2024 11:10:04 +0000 Subject: 52549: document return works in a script --- Doc/Zsh/builtins.yo | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Doc/Zsh') diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo index 1aa807633..7a8654f27 100644 --- a/Doc/Zsh/builtins.yo +++ b/Doc/Zsh/builtins.yo @@ -1649,7 +1649,9 @@ 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). +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)': example(() { integer foo=40; return "foo + 2" } -- cgit 1.4.1