break

Programming

Exit the innermost for or while loop immediately. Execution continues with the statement after the loop end.

Syntax

break

Examples

for i = 1:100
  if i > 5
    break
  end
  disp(i)
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.