This site is a preview of the curriculum for our Summer 2018 bootcamp in Burlington, Vermont. As we continue our preparation, courses and lessons will appear and disappear; we will rename, rearrange, clarify, and obfuscate as needed... Please consider this a work in progress and keep checking in.
Learn to Code with Ruby:
An OBJECT is a location in computer memory where you can store DATA (aka VALUES).
There are many kinds of objects, including String, Number, Array, Hash, Time, ...
(The different kinds of objects are called CLASSES or TYPES. Some day soon you will create your own classes but for now, we will use the built-in ones.)
A NUMBER is what it sounds like.
10 -12 3.14
A STRING is an object that's a collection of characters, like a word or a sentence.
"apple" "banana" "Cherry Pie"
Messages and Operators
An object responds to MESSAGES. You send it messages using OPERATORS.
The most powerful operator is DOT.
On screen she looks like this...
Dot up close
...but here's what she looks like up close:
Dot can send any message she likes, by name, to any object.
upcase message turns
There are other operators, like PLUS (
+) and TIMES (
*), but they only send one message each.
And remember, Dot is more powerful than any other operator!
2 + 7
is the same as
Both send the message
+ to the object
Every time an object receives a message, it returns a response.
The response is also called the VALUE or the RETURN VALUE.
You can think of it as the answer to a question.
2 + 2 # Question: What is 2 + 2? 4 # Answer: 4 "apple".upcase # Q: What is the upcase of the string "apple"? "APPLE" # A: the string "APPLE"