Ruby
Using for statement, run loop process.
in Ruby
Using for statement, run loop process.Fetch the values in order from the specified object after "in", and store it in the variable specified before "in".
"do" can be omitted.
for_loop.rb
for count in 1..5 do print("loop count = ", count, "\n"); end for count in 6..10 print("loop count = ", count, "\n"); end
Result
$ ruby for_loop.rb loop count = 1 loop count = 2 loop count = 3 loop count = 4 loop count = 5 loop count = 6 loop count = 7 loop count = 8 loop count = 9 loop count = 10