Slide 20
Slide 20 text
ARRAY
Easy to create
• a = [5, 10, 45, 9]
• a = Array.new(5, 10, 45, 9) # works, but not usually used.
Easy to access & modify
• a[2] # => 45
• a[0] = 1000 # => [1000, 10, 45, 9]
Polyglot
• b = [“banana”, 3.14, -200, “Hello World”]
• Mix & match values
Dynamically Sized
• fruits = [“Apple”, “Banana”]
• fruits[2] = “Orange” # => [“Apple”, “Banana”, “Orange]
• fruits.length # => 3