title: if integer is greater than x but less than y (Swift)
body: <p>I was wondering if there is any smooth way of checking the value of an integer in a range in swift.</p>
  
  <p>I have an integer that can be any number between 0 and 1000</p>
  
  <p>I want to write an if statement for "if the integer is between 300 and 700 - do this and if its any other number - do something else"</p>
  
  <p>I could write:</p>
  
  <pre><code>if integer &gt; 300 {
      if integer &lt; 700 {
        //do something else1
      }
      //do something
  } else {
      // do something else2
  
  }
  </code></pre>
  
  <p>But I want to minimize the amount of code to write since "do something else1" and "do something else2" are supposed to be the same</p>
  
  <p>It doesn't seem that you can write :</p>
  
  <pre><code>if 300 &lt; integer &lt; 700 {
  
  } else {
  
  }
  </code></pre>
  
  <p>I tried using </p>
  
  <pre><code>if integer == 300..&lt;700 {
  }
  </code></pre>
  
  <p>but that didn't work either. Anybody got a suggestion?</p>