title: How to modify loop variable in ruby?
body: <pre><code>for i in (0..5)
    if(i==0)
      i=4
    end
    puts i
  end
  </code></pre>
  
  <p>In the above program I excepted the output as - <code>4 5</code> </p>
  
  <p>But instead it is - <code>4 1 2 3 4 5</code></p>
  
  <p>So I conclude that loop variable isnt changing. How can change it? Can anyone tell me?</p>
  
  <p>Actually, In my program I need to save the current state of loop and retrive later so that on the next start program resumes from the same point where it was left.</p>