return

Programming

Return from the current function immediately. In a script context, terminates execution of the script.

Syntax

return

Examples

function y = safediv(a, b)
  if b == 0
    y = Inf;
    return
  end
  y = a / b;
end
▶ Run

See Also

Try SimLab — Free MATLAB® Alternative

466 functions. Runs in your browser. No install.

Open SimLab

Stay Updated

Get notified about new simulations and tools. We send 1-2 emails per month.