Hi,
I have a 'while' loop inside a 'while' loop.
while
%%%
while
%%%
break
end
%%% statement 1
%%% statement 2
end
I wonder the location of 'break' in this case would break only the inner 'while' loop or break even the outer 'while' loop?
In this case, will it still run 'statement 1' and 'statement 2'?
If not, how do I make sure it only break the inner loop and still run 'statement 1' and 'statement 2'?

 Respuesta aceptada

Fangjun Jiang
Fangjun Jiang el 14 de Nov. de 2019

0 votos

From help break
In nested loops, break exits from the innermost loop only

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 14 de Nov. de 2019

Respondida:

el 14 de Nov. de 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by