Click here to navigate the course.

Drag the edges to resize the window.

In Projects, you can keep track of your progress as you go throught the tasks. Check each item as you complete it!

Code Editor

Learn

Introduction to Ruby

Ruby isn't limited to simple expressions of assignment like `my_num = 100`

; it can also do all the math you learned about in school.

There are six arithmetic operators we're going to focus on:

Addition (`+`

)

Subtraction (`-`

)

Multiplication (`*`

)

Division (`/`

)

Exponentiation (`**`

)

Modulo (`%`

)

The only ones that probably look weird to you are exponentiation and modulo. Exponentiation raises one number (the base) to the power of the other (the exponent). For example, `2**3`

is `8`

, since `2**3`

means "give me `2 * 2 * 2`

" (2 multiplied together 3 times). `3**2`

is `9`

(3 * 3), and so on.

Modulo returns the remainder of division. For example, `25 % 7`

would be `4`

, since 7 goes into 25 three times with 4 left over.

Report a Bug

If you see a bug or any other issue with this page, please report it here.

Learn

Report a Bug

Learn

Report a Bug