RosettaCodeData/Task/Collections/Ruby/collections.rb

9 lines
206 B
Ruby

# creating an empty array and adding values
a = [] # => []
a[0] = 1 # => [1]
a[3] = 2 # => [1, nil, nil, 2]
# creating an array with the constructor
a = Array.new # => []