1. Computing

Using the Command Line

By

10 of 10

Test the Interactive Ruby Prompt

Type the "hello world" statement we've been using throughout this series of tutorials into the prompt and hit Enter. You'll see any output the statement generated as well as the return value of the statement before being returned to the prompt. In this case, the statement output "Hello world!" and it returned nil.

irb(main):001:0> puts "Hello world!"
Hello world!
=> nil
irb(main):002:0>

To run this command again, simply press the up key on your keyboard to get to the statement you previously ran and press the Enter key. If you want to edit the statement before running it again, press the left and right arrow keys to move the cursor to the correct place in the statement. Make your edits and press Enter to run the new command. Pressing up or down additional times will allow you to examine more of statements you've run.

  1. About.com
  2. Computing
  3. Ruby
  4. Beginning Ruby
  5. Using the Command Line

©2014 About.com. All rights reserved.