O'Reilly logo

Sams Teach Yourself Ruby in 21 Days by Mark Slagell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Ruby Interactively

If you run ruby without providing a command or a program file name, something funny happens. No prompt appears on the screen, but the computer just sits there waiting for you to type things. (You may have already stumbled into this situation.) What's going on? You have invoked the ruby interpreter, and what the interpreter wants to do is to run a Ruby script; that is its only reason for living. Since you didn't provide a script in advance, the interpreter sits patiently, waiting for you to fulfill your obligation and give it something to do.

You can type an instruction or two, or a lengthy script if you want, pressing Enter at the end of each line; when you finish, it will execute the script and return you to your normal ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required