MATLAB: Switch function that does not work

switch function

What is wrong here:
This is my text:
function grade=switchletgrade1(quiz)
if quiz<0 ||quiz>4
grade='X'
else switch quiz
case 3
grade='B'
case 4
grade='A'
otherwise
grade='C'
end
end
end

Best Answer

Your code works error-free for me.
Is it possible that you are inadvertently calling a different file with a pre-debugged version? Does the command
>> which switchletgrade1
give the file location you expect?