1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Using the Command Line

By

9 of 10

Start the Interactive Ruby Prompt

The interactive Ruby tool should be used throughout learning Ruby. It provides an interface to the Ruby language for instant experimentation. This comes in handy while learning Ruby and experimenting with things like regular expressions.

When you learn about a new feature or just want to try something, start up the interactive Ruby prompt and try it. See what the statement returns, pass different parameters to it and just do some general experimenting. Trying something yourself and seeing what it does can be a lot more valuable then just reading about it!

Ruby statements can be run and the output and return values can be examined immediately. If you make a mistake, you can go back and edit your previous Ruby statements to correct those mistakes.

To start the IRB prompt, open your command-line and run the irb command. You'll be presented with the following prompt:

irb(main):001:0>
  1. About.com
  2. Technology
  3. Ruby
  4. Beginning Ruby
  5. Using the Command Line

©2014 About.com. All rights reserved.