MATLAB
The user is supposed to enter either a ‘yes’ or ‘no’ in responseto a prompt. The script will print “OK, continuing†if the userenters either a ‘y’, ‘Y’,'Yes', or 'yes' or it will print “OK,halting†if the user enters a ‘n’, ‘N’, 'No', or 'no' or will print“Error†if the user enters anything else.
Code this twice once with if and once withswitch:
Then recode the example above to keep promptinguntil an an acceptable yes or no is entered:
What loop should we use?
what should we intialize?
please generate all code for Matlab