All of the iterators automatically pass the state of the iteration to the looped code as a parameter.
You can then retrieve into a variable and use, like so:
1.upto(5) { |number| puts number }
For example, this code works in exactly the same way as that in the previous example:
1.upto(5) do |number| puts number end