friends =["Kevin","Karen","Oscar","Angela","Andy"]
for friend in friends puts friend end
Kevin Karen Oscar Angela Andy
for element in friends puts element end
Kevin Karen Oscar Angela Andy
friends.each do |friend| puts friend end
Kevin Karen Oscar Angela Andy
for index in 0..5 puts index end
0 1 2 3 4 5
6.times do |index| puts index end
0 1 2 3 4 5
Recommended Posts