title: how to skip a few iterations in a loop in Ruby?
body: <p>Suppose I have the C code below</p>
  
  <pre><code>for(i = 0; i &lt; 10; i++){
      printf("Hello");
      if(i == 5){
          a[3] = a[2] * 2;
          if(a[3] == b)
              i = a[3];           //Skip to index = a[3]; depends on runtime value
      }
  }
  </code></pre>
  
  <p>How to convert to Ruby? I know we can skip one iteration using <code>next</code>, but I have to skip a few iterations depending on conditional value and I don't know how many iterations to skip before runtime?</p>
  
  <hr>
  
  <p>Here is the code I am actually working on (as mentioned by Coreyward):</p>
  
  <p>I am looking for "straight line" in the array that the values differs less than 0.1(less than 0.1 will considered as a "straight line"). The range has to be longer than 50 to be considered as a long "line". After I find the line range [a,b], i wanna skip the iterations to upper limit b so it would not start again from a+1, and it will start to find new "straight line" from b+1</p>
  
  <pre><code>for(i=0; i&lt;arr.Length; i++){
    if(arr[i] - arr[i + 50] &lt; 0.1){
      m = i;                                   //m is the starting point
      for(j=i; j&lt;arr.Length; j++){             //this loop makes sure all values differs less than 0.1
        if(arr[i] - arr[j] &lt; 0.1){
          n = j;
        }else{
          break;
        }
      }
      if(n - m &gt; 50){                          //Found a line with range greater than 50, and store the starting point to line array
        line[i] = m
      }
      i = n                                     //Start new search from n
    }
  </code></pre>
  
  <p>}</p>