Mega Code Archive

 
Categories / Ruby / Statement
 

Use for to loop through array index

array = ['cherry', 'strawberry', 'orange'] for index in (0...array.length)   puts "At position #{index}: #{array[index]}" end