O'Reilly logo

Ruby by Example by Kevin C. Baird

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

Chapter 2. Amusements and Simple Utilities

image with no caption

From the previous chapter, you should now be relatively comfortable with irb and how Ruby deals with various expressions. Now we’ll try some Ruby programs that are stored in separate files and executed outside of irb. You can download all of these programs at http://www.nostarch.com/ruby.htm.

We’ll run our programs with the ruby command, so when we want to run a script called check_payday.rb, we’ll type ruby check_payday.rb either at the shell in a Unix-like system or at the command prompt in Windows. We’ll also generally use the -w option, which means turn warnings on, making our example above become

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