How to keep looping a switch statement?

14 vues (au cours des 30 derniers jours)
Ame Michael
Ame Michael le 25 Avr 2018
How can I keep looping a switch statement until the user types the word "stop"?
I want the switch to keep looping through the cases until the user types "stop", to which the loop will break.

Réponses (1)

Stephen23
Stephen23 le 25 Avr 2018
str = '';
while ~strcmp(str,'stop')
...
str = ...
end

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by