Ruby has many methods for modifying arrays. What did these two methods do?
Arrays are used whenever you need to work with a large group of similar items.
A short list of methods for Array:
how long is this array (how many elements)
get the first element of the array (same as array)
get the last element of the array (same as array[-1])
add a new element to the end of the array
remove (and return) the element at the end of the array
We are learning that different types of objects in ruby have different sets of methods. We can call pop on object of type Array, but we can't call it on an object of type Float.
Type this in irb:
In object oriented programming, each type of object shares a common list of methods. This list of methods is different for every type of object. When you attempt to call a method that is not available for the object's type, you get a NoMethodError and the interpreter stops running the program.