Alternative to "continue"
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello, is there any alternative to that continue?

0 Commenti
Risposte (2)
Image Analyst
il 6 Dic 2017
You could wrap everything in an if
for .......
if m == 0
% Code you want to run
else
fprintf('O Username deve .............
end
end
That doesn't use a continue.
3 Commenti
Walter Roberson
il 6 Dic 2017
The code you display here has no way to exit the while loop, because nothing changes x . We must suspect that after the if m ~= 0 that you have more code that might change x, with the general structure
while x == true
some code here
if m ~= 0
display error
continue;
end
some more code here
end
You would change that to
while x == true
some code here
if m ~= 0
display error
else
some more code here
end
end
Guillaume
il 6 Dic 2017
- Why do you ask?
- Programming languages are efficient. This means that if there is an instruction to do something, there's not going to be another one to do the exact same thing.
- Maybe there is an alternative but that would depend on the for loop that encloses the piece of code you've shown, so you've not even shown enough code to answer your question.
0 Commenti
Vedere anche
Categorie
Scopri di più su Performance and Memory in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
