Looping a switch statement
显示 更早的评论
I currently have the code below, in which the user is asked to enter a task, which then uses the switch statement shown below.
switch task
case 'create a file'
fprintf('You have chosen to create a file \n');
case 'quit'
fprintf('You have chosen to quit \n');
break;
otherwise
fprintf('You have entered an action not on the list\n');
fprintf('You will now be directed to the start again to select another action \n');
I was wondering how to loop it back to the beginning and continually ask for the user to input a task and how to exit fully out of the loop if the user enters 'quit'
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Linear Algebra 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!