For each element in a range : in « Statement « Ruby






For each element in a range


for element in (1..3)
  puts element
end
# 1
# 2
# 3

 








Related examples in the same category

1.For each element in an array
2.Use for to loop through array index