Answers.Body: <p>I just discovered this a few days ago. If you use "Numeric" as the input type and switch to tabbed view, you can have a select/case/default type instruction instead of if/then. It also works with text input as well as as some sensors.</p>
  
  <p><img src="https://i.sstatic.net/9ys3B.png" alt="enter image description here"></p>
  
  <p><img src="https://i.sstatic.net/mkBv8.png" alt="enter image description here"></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-03-17T12:33:27.950Z
Answers.LastActivityDate: 2014-03-17T12:33:27.950Z
Answers.UserDisplayName: David Lechner
Answers.Body: <p>Yes, multiple switch statements can be nested inside each other.</p>
  
  <p>However, given the problem of a measuring a motor's rotation and converting that into a user choice doing the math first and using that result in a single switch statement is possible.</p>
  
  <p>Also, the logic will need to run more than once and give the user some indication of the current selection.  That much, might look like this:</p>
  
  <p><a href="https://i.sstatic.net/qkGgE.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/qkGgE.png" alt="enter image description here"></a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-10-28T23:00:14.677Z
Answers.LastActivityDate: 2017-10-28T23:00:14.677Z
Answers.UserDisplayName: dfrevert
Answers.Body: <p>It depends on what problem you're trying to solve.  If you need a large, multi-part switch statement, then Sergei's answer above is genius and definitely correct.  I just discovered that the first <code>if</code> counts as the default.  This is different than C or Java where the default condition is optionally coded at the bottom of a switch statement.  The only time nested <code>if</code> statements make sense is if it creates clarity within the program.  I'd much rather look at one large switch block with all of the cases listed than to see it broken up with multiple if/else blocks. i.e.</p>
  <pre><code>if
  else if
  else if
  else if
  else
  </code></pre>
  <p>looks a lot more clear than a messy bunch of nested if/else statements.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-12-27T05:35:13.440Z
Answers.LastActivityDate: 2021-12-27T13:38:18.643Z
Answers.LastEditDate: 2021-12-27T13:38:18.643Z
Answers.UserDisplayName: blyons
Answers.Body: <p>I would suggest stacking your switch statements by placing switch statements into one another like in the below image. Make sure your conditions overlap, so you are only testing for values in A1 and A2 that are WITHIN your A condition, same for B. </p>
  
  <p><a href="https://i.sstatic.net/gmGBd.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/gmGBd.png" alt="Switches in a switch"></a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-10-27T03:59:07.707Z
Answers.LastActivityDate: 2017-10-27T04:04:38.383Z
Answers.LastEditDate: 2017-10-27T04:04:38.383Z
Answers.UserDisplayName: Magnon
Body: <p>What I see is just a simple if/then/else. What I am looking for is to be able to add multiple options, more than yes/no. </p>
  
  <p>I use a motor as a switcher, so I rotate it to some position and measure its degrees to switch the mode of the robot and there are going to be more than 2 modes, like 4-8. How can I do it in an elegant way?</p>
  
Tags: <mindstorms><ev3><software>
Title: How can I use multiple switch options in Lego Mindstorms EV3 software?
UserDisplayName: Sergei Basharov
ThreadText: # How can I use multiple switch options in Lego Mindstorms EV3 software?
  
  (Asked by: username_0 on 2014-03-17)
  
  What I see is just a simple if/then/else. What I am looking for is to be able to add multiple options, more than yes/no.
  
  I use a motor as a switcher, so I rotate it to some position and measure its degrees to switch the mode of the robot and there are going to be more than 2 modes, like 4-8. How can I do it in an elegant way?
  
  **Tags:** mindstorms, ev3, software
  
  ---
  
  ## 4 answers
  
  ### Answer by username_1 on 2014-03-17. Score: 5 | Accepted answer
  
  I just discovered this a few days ago. If you use "Numeric" as the input type and switch to tabbed view, you can have a select/case/default type instruction instead of if/then. It also works with text input as well as as some sensors.
  
  ![enter image description here](https://i.sstatic.net/9ys3B.png)
  
  ![enter image description here](https://i.sstatic.net/mkBv8.png)
  
  
  ---
  
  ### Answer by username_4 on 2017-10-27. Score: 2
  
  I would suggest stacking your switch statements by placing switch statements into one another like in the below image. Make sure your conditions overlap, so you are only testing for values in A1 and A2 that are WITHIN your A condition, same for B.
  
  [![Switches in a switch](https://i.sstatic.net/gmGBd.png)](https://i.sstatic.net/gmGBd.png)
  
  
  ---
  
  ### Answer by username_2 on 2017-10-28. Score: 1
  
  Yes, multiple switch statements can be nested inside each other.
  
  However, given the problem of a measuring a motor's rotation and converting that into a user choice doing the math first and using that result in a single switch statement is possible.
  
  Also, the logic will need to run more than once and give the user some indication of the current selection. That much, might look like this:
  
  [![enter image description here](https://i.sstatic.net/qkGgE.png)](https://i.sstatic.net/qkGgE.png)
  
  
  ---
  
  ### Answer by username_3 on 2021-12-27. Score: 0
  
  It depends on what problem you're trying to solve.  If you need a large, multi-part switch statement, then Sergei's answer above is genius and definitely correct.  I just discovered that the first if counts as the default.  This is different than C or Java where the default condition is optionally coded at the bottom of a switch statement.  The only time nested if statements make sense is if it creates clarity within the program.  I'd much rather look at one large switch block with all of the cases listed than to see it broken up with multiple if/else blocks. i.e.
  if
  else if
  else if
  else if
  else
  
  looks a lot more clear than a messy bunch of nested if/else statements.
  
  
  ---
  
  