title: How to switch statements for digit ranges?
body: <p>I'd like to write a switch statement based on a digit range:</p>
  
  <pre><code>1 &lt;= x &lt;= 4: index = 1
  5 &lt;= x &lt;= 7: index = 2
  8 &lt;= x &lt;= 10: index = 3
  (more to come)
  </code></pre>
  
  <p>Based on the range <code>x</code> is in I want to set the index.<br>
  Could I do better apart from nesting if-else statements?</p>
  
  <pre><code>if (number &gt; 0 &amp;&amp; number &lt; 5) {
      index = 1;
  } else if (number &gt; 4 &amp;&amp; number&lt; 8) {
      index = 2;  
  } else if (number &gt; 7 &amp;&amp; number &lt; 11) {
      index = 3;
  }
  </code></pre>