Mega Code Archive

 
Categories / Ruby / Array
 

Elements can be accessed by their index (their position within the array)

x = [1, 2, 3, 4] puts x[2]