Other Pages

Expand All



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.



A STRING is an object that's a collection of characters, like a word or a sentence.

"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's job

Dot can send any message she likes, by name, to any object.


The upcase message turns "apple" into "APPLE".

Other Operators

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

2.+ 7

Both send the message + to the object 2.

Return Values

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
# Q: What is the upcase of the string "apple"?
# A: the string "APPLE"
Back to Learn To Code

If you find something that could be improved, please make a pull request or drop us a note via GitHub Issues (no technical knowledge required).

Source: https://github.com/RailsBridge-CapeTown