title: Avoid entering a for loop when the start is larger than the end
body: <p>The function receives an integer parameter c that takes values from 1 to some positive n, and I want that the loop doesn't iterate when c=1 i.e when start value of the for loop is larger than the end value. </p>
  
  <p>Approach shown below doesn't work:</p>
  
  <pre><code>repeted_f&lt;-function(C_matrix, g, n, c, aux) {
    for(c_i in (2:c)) {
       #some small code here
    }
    return (F);
  }
  </code></pre>
  
  <p>If c=1 c_i will iterate 2 and 1 rather than not iterate at all.</p>
  
  <p>I have also tried replacing (2:c) by seq(2,c, by=1) hoping that this would give me an empty set, but I get an error:</p>
  
  <pre><code>Error in seq.default(2, c, by = 1) : wrong sign in 'by' argument
  </code></pre>
  
  <p>I know I can just check if (2>=c) before getting into the loop, but I was looking for a more elegant solution.</p>