Arrays

Overview

  • An Array uses the familiar [a, b, c] format.
  • Are sized dynamically and can be of mixed types. a = [‘string’, 1, :symbol]

Try typing this in IRB

a = [1, 2, 3]

a << 4 a[0]

a.first a.last

What do you think will happen?

“Chelsea will beat Liverpool”[0,1]

Exercises