Learn ruby, beginner's tutorial
Find other posts in the same category:

More details


You need to have cookies enabled.
There is no way to skip a step within a lesson. (You can use the up arrow to avoid retyping the last command.)

I couldn't get copy and paste to work. So it took a lot of typing.

Help 2 to skip to lesson 2 did not work. While I was doing lesson 5, something went wrong and it sent me back to the beginning.

It's a shame the author does not provide this as a pdf that can be printed out.

Lesson #1
you learn to do arithmetic with + - * /
you learn to reverse a string
you learn the difference between a string and a number

Lesson #2
You learn the methods
to_s convert to string
to_i convert to integer
to_a convert to array
you learn to set a variable
ticket = [12, 47, 35]
you learn to sort a variable

The ! mark changes the variable forever

Lesson #3
print poem.to_a.reverse.join
here the author links to a list of all ruby string methods

Now Arriving at Summary #4

Blocks are always attached to methods. Like the times method, which takes the block and runs the code over and over. (In this case: five times.)

This last lesson was a bit longer. You've probably used up three minutes learning about:

* Hashes. The little dictionary with the curly pages: {}.
* Symbols. Tiny, efficient code words with a colon: :splendid.
* Blocks. Chunks of code which can be tacked on to many of Ruby's methods. Here's the code you used to build a scorecard:
books.values.each { |rate| ratings[rate] += 1 }.

To see articles on the same topic, click the links below the name of the author at the top of this page.
Authored by ruby on Jul 30, 2008.
Authored by guest on Jul 31, 2008.

I don't know if it's down. It's not working right now.