concatenate is with the << method : Array Addition « Array « Ruby






concatenate is with the << method


yrs = [1999]
yrs << 2000 # => [1999, 2000]

# You can chain these, too:

yrs << 2001 << 2002 << 2003 # => [1999, 2000, 2001, 2002, 2003]

 








Related examples in the same category

1.Array Addition and Concatenation
2.Concatenation with the + operator