Complete the code to start a switch-case statement for variable color.
switch [1] case 'red' disp('Stop'); otherwise disp('Go'); end
The switch statement must be followed by the variable you want to check, here color.
Complete the code to display 'Go' when the color is not 'red'.
switch color
case 'red'
disp('Stop');
[1]
disp('Go');
endThe otherwise keyword handles all cases not matched by previous case labels.
Fix the error in the switch-case syntax by completing the missing keyword.
switch day
[1] 'Monday'
disp('Start of week');
case 'Friday'
disp('End of week');
endEach condition in a switch-case must start with the case keyword.
Fill both blanks to create a switch-case that displays 'Weekend' for Saturday and Sunday.
switch day
[1] 'Saturday'
disp('Weekend');
[2] 'Sunday'
disp('Weekend');
otherwise
disp('Weekday');
endEach condition in a switch-case must start with the case keyword.
Fill all three blanks to create a switch-case that prints the day type based on the variable day.
switch [1] case 'Saturday' disp([2]); case 'Monday' disp([3]); otherwise disp('Midweek'); end
The switch statement checks the variable day. For 'Saturday' it displays 'Weekend', and for 'Monday' it displays 'Start of week'.