Ruby Language Basic Usage


Example

IRB means "Interactive Ruby Shell", letting us execute ruby expressions from the standart input.

To start, type irb into your shell. You can write anything in Ruby, from simple expressions:

$ irb
2.1.4 :001 > 2+2
=> 4

to complex cases like methods:

2.1.4 :001> def method
2.1.4 :002?>   puts "Hello World"
2.1.4 :003?> end
=> :method
2.1.4 :004 > method
Hello World
=> nil