break
Ends execution of the nearest enclosing loop, even if the end condition for the loop has not been satisfied. break will not end execution of multiple, nested loops.
Syntax
break
Example
Using break in a for
loop:
a = 0
for j = 1:10000
if a == 5
break
end
a = a+1;
end
a
a = 0
a = 5