Switch case inside of another switch case

26 views (last 30 days)
António
António on 30 Dec 2014
Edited: Jan on 30 Dec 2014
How can i put a switch case inside of another switch case?

Answers (1)

Sean de Wolski
Sean de Wolski on 30 Dec 2014
x = 2;
y = 3;
switch x
case 1
disp 1
case 2
switch y
case 2
disp Ha!
case 3
disp HaHa!
otherwise
disp Nah
end
end
  1 Comment
Jan
Jan on 30 Dec 2014
Edited: Jan on 30 Dec 2014
+1. A complete answer although it is trivial.

Sign in to comment.

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!