Using Ruby, how can I iterate over a for loop n.times
If you need an index:
5.times do |i|
print i, " "
end
Returns:
0 1 2 3 4
Reference: https://apidock.com/ruby/Integer/times
3.times do
# do work here
end
check http://www.tutorialspoint.com/ruby/ruby_loops.htm