Leading zero and increment in ruby
I was looking on how to have a leading zero in ruby, and I found out the solution: use %02d"
Now, I'd like to do a loop, and keep this zero !
When I do something like this

    i = "%02d" % "1".to_i
    until (i == 10)
    puts i
    i += 1
    end
I have an error "Cannot convert FixNum to string".
So I decide to do this

    i = "%02d" % "1".to_i
    "01"
    until (i == 10)
    puts i
    i = i.to_i
    i += 1
    end
So, this time, the loop work, but only the first number have the leading 0.
I ran out of idea, so I'd appreciate a little help !
Thank you SO !


 
Leading zero and increment in ruby
===

I was looking on how to have a leading zero in ruby, and I found out the solution: use %02d"
Now, I'd like to do a loop, and keep this zero !
When I do something like this

    i = "%02d" % "1".to_i
    until (i == 10)
    puts i
    i += 1
    end
I have an error "Cannot convert FixNum to string".
So I decide to do this

    i = "%02d" % "1".to_i
    "01"
    until (i == 10)
    puts i
    i = i.to_i
    i += 1
    end
So, this time, the loop work, but only the first number have the leading 0.
I ran out of idea, so I'd appreciate a little help !
Thank you SO !


 