title: Writing inequalities in r if statements
body: <p>I'm constructing a function in r. In the function, I am generating a random number and calling it x. I want my function to do different things:</p>
  
  <ul>
  <li><code>If x is less than 0.1 (0 &lt;= x &lt; 0.1)</code> </li>
  <li><code>If x is less than 0.2 (0.1 &lt;= x &lt; 0.2)</code></li>
  <li>etc up to 1.</li>
  </ul>
  
  <p>I want to write:</p>
  
  <pre><code>Myfunction = function() {   
      x = runif(1)
  
      if(0 &lt;= x &lt; 0.1) {
          do something...
      }
  
      if(0.1 &lt;= x &lt; 0.2) {
          do something... (etc)
      }
  }
  </code></pre>
  
  <p>But this doesn't work. How could I get around this?</p>