Mega Code Archive

 
Categories / Ruby / Array
 

A basic array with []

x = [1, 2, 3, 4] # This array has four elements.  # Each element is an integer, and is separated by commas from its neighboring elements.  # All the elements are contained within square brackets.