How do I do this type of for loop in Ruby?
for(int i=0; i
If you don't need to access your array, (just a simple for loop) you can use upto or each :
Upto:
1.9.3p392 :030 > 2.upto(4) {|i| puts i} 2 3 4 => 2
Each:
1.9.3p392 :031 > (2..4).each {|i| puts i} 2 3 4 => 2..4