Return
Examples
open all close allBasic Examples (1)
Possible Issues (1)
Return exits only the innermost construct in which it is invoked:
f[x_] := (If[x > 5, Return[a]];x)f[6]Here it exits the Do loop, but not the function g:
g[x_] := (Do[If[x > 5, Return[a]], {3}];x)g[6]Use Catch and Throw for explicit flow control:
h[x_] := Catch[Do[If[x > 5, Throw[a]], {3}];x]h[6]See Also
Tech Notes
Related Guides
Related Links
History
Introduced in 1988 (1.0) | Updated in 1996 (3.0)
Text
Wolfram Research (1988), Return, Wolfram Language function, https://reference.wolfram.com/language/ref/Return.html (updated 1996).
CMS
Wolfram Language. 1988. "Return." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 1996. https://reference.wolfram.com/language/ref/Return.html.
APA
Wolfram Language. (1988). Return. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Return.html
BibTeX
@misc{reference.wolfram_2026_return, author="Wolfram Research", title="{Return}", year="1996", howpublished="\url{https://reference.wolfram.com/language/ref/Return.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_return, organization={Wolfram Research}, title={Return}, year={1996}, url={https://reference.wolfram.com/language/ref/Return.html}, note=[Accessed: 13-June-2026]}