Answers.Body: <p>You can put all of the logic outside of the switch block and use the "Logic" input of the switch block. You can do exactly what you have described in pseudo code since there are "less than"/"greater than" blocks and an "and" block.</p>
  
  <p><a href="https://i.sstatic.net/TE7Re.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/TE7Re.png" alt="enter image description here"></a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-15T17:56:37.893Z
Answers.LastActivityDate: 2017-11-15T17:56:37.893Z
Answers.UserDisplayName: David Lechner
Body: <p>I can't find a way to emulate an AND statement in a switch statement:</p>
  
  <pre><code>if (angle &gt;= 10 and angle &lt;= 30)
     ;// do smth
  else
     ; // this is what I want
  </code></pre>
  
  <p>Until now, I just nested two if statements, but now I want to introduce an else case, but I don't want to duplicate the statements in the else condition two times (one in the first if, the second one in the nested one).</p>
  
  <p>Is there a better way?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-11-15T10:16:03.797Z
Comments.Text: Hi SchoolGuy and welcome to Bricks! Which language are you using to program your EV3? (Hopefully you can edit your question to include that).
Comments.UserDisplayName: Zhaph - Ben Duguid
Tags: <ev3><software>
Title: How do I have an else in conjunction with an if statement with two conditions?
UserDisplayName: SchoolGuy
ThreadText: # How do I have an else in conjunction with an if statement with two conditions?
  
  (Asked by: username_0 on 2017-11-15)
  
  I can't find a way to emulate an AND statement in a switch statement:
  if (angle >= 10 and angle <= 30)
     ;// do smth
  else
     ; // this is what I want
  
  Until now, I just nested two if statements, but now I want to introduce an else case, but I don't want to duplicate the statements in the else condition two times (one in the first if, the second one in the nested one).
  Is there a better way?
  
  **Tags:** ev3, software
  > **Comments:**
  > **username_1**: Hi SchoolGuy and welcome to Bricks! Which language are you using to program your EV3? (Hopefully you can edit your question to include that).  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2017-11-15. Score: 2
  
  You can put all of the logic outside of the switch block and use the "Logic" input of the switch block. You can do exactly what you have described in pseudo code since there are "less than"/"greater than" blocks and an "and" block.
  
  [![enter image description here](https://i.sstatic.net/TE7Re.png)](https://i.sstatic.net/TE7Re.png)
  
  
  ---
  
  