foo = [3, 6, 3] for a in foo: print a How do I do that in ruby?
Your already have both correct answers about "for"-loop. But in Exactly your example, i'll use:
puts foo Also you can use this puts' feature in such case:
puts array.map { |i| ...some code...; x } instead of
array.each { |i| ...some code...; puts x } for example, if you want to call puts only once.