Question: Please use MatLab 2) Rewrite the following if-else statement using a switch statemen. Assume that there is a valid variable KeyNum and that it has
2) Rewrite the following if-else statement using a switch statemen. Assume that there is a valid variable KeyNum and that it has been assigned with a value. if KeyNum ==1 Action = 'Walk'; elseif KeyNum ==2 Action = 'Run'; elseif KeyNum == 3 Action = 'Stay'; else Action = 'Good-Bye'; end
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
