Filter löschen
Filter löschen

exiting if condition and for loop?

118 Ansichten (letzte 30 Tage)
Arunachalam  D
Arunachalam D am 18 Jul. 2015
Bearbeitet: Stefanie Schwarz am 4 Jan. 2022
for i=1:100
if condition
operations;
else
continue
end
end
here continue will exit out of the if loop but thing is that if else statement executed it should come out of for loop. how can i do that

Akzeptierte Antwort

per isakson
per isakson am 18 Jul. 2015
Try
for i=1:100
if condition
operations;
else
break
end
end

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by