Understand how and when to use irb
Understand how to start and stop irb
Understand the difference between irb and the command line
Execute some simple Ruby statements
irb will run until you quit.
You're back at the command line. Notice that the prompt no longer says irb.
exit is the guaranteed way to get out of irb. Depending on your
operating system, Control-C or Control-D on an empty line may also work.
Practice going in and out of irb a couple of times. How can you tell
when you're in irb? How can you tell when you're back at the command line?
Lets take a closer look at the output of irb:
1.9.3p125 :015 > 1 + 2
1.9.3p125 :016 >
=> 3 is the return value of the statement
1 + 2,
the result of running your code.
Every statement in Ruby has a return value: irb shows you that
value after you type a complete statement and press ENTER.
irb is a place to experiment and find out how certain language
features work. It's not a good place to write long programs. It doesn't let
you save your work, and it's not a very friendly text editor.
When you write a full-fledged program, you'll save it into a text
file on your computer. We'll see this in a later step.