WLJS LogoWLJS Notebook

Return

Return[expr] returns the value expr from a function.

Return[] returns Null.

Examples

Return from a function:

f[x_] := Module[{},
  If[x < 0, Return["negative"]];
  x^2
]
f[-3]
(* "negative" *)

Please visit the official Wolfram Language Reference for more details.

On this page