3. Everything is an Object
• An integer is an object 12
• A float is an object 1.333
• A string is an object “Ruby is awesome”
• An array is an object [“apple”,“orange”]
• A hash is an object { state: “Illinois”,
zipcode: “60606”}
• & many, other types (blocks, lambdas, modules,
classes) are also objects
4. Strings
• Anything surrounded by
• Text based characters, typically representing words
“Ruby is fun”
“I am a string”
“S”
• But can also be non-alphabet characters
“78”
“W2 2Sy”
quotes
6. Arrays
bulls = [“Rose”, “Butler”, “Gasol”, “Noah”, “Brooks”]
0 1 2 3 4
• Each element in the array is associated with and referred
to by an index
bulls[0] = ?
bulls[4] = ?
• Ordered, integer-indexed collection
• Can hold objects such as strings, integers, hashes and
other array objects
11. Hash methods
• Start up your terminal
• Type ‘irb’
• Let’s look up the docs (try google: ruby 2.2 docs
hash)
12. • Everything is an object
• Strings are anything in between quotes
• Arrays are indexed and start at 0
• Hashes are unique key-value pairs
• Check the official ruby docs for methods for
each!
Recap