Arrays and Common Methods
Arrays in Ruby are ordered collections of elements.
Creating Arrays:
fruits = ["apple", "banana", "cherry"]Accessing Elements:
puts fruits[0] # apple
puts fruits[-1] # cherryCommon Methods:
pushor<<: Add elementspop: Remove last elementeach: Iterate over elementsmap,select,reject: Functional operations
