Skip to Main Content
Learn to Program, 2nd Edition
book

Learn to Program, 2nd Edition

by Chris Pine
March 2009
Intermediate to advanced content levelIntermediate to advanced
194 pages
4h
English
Pragmatic Bookshelf
Content preview from Learn to Program, 2nd Edition

Doing Something

So far, after your program is done running, there’s really no evidence that it ever ran (aside from your memory of it). Nothing on your computer has been changed at all. The least I can do is show how to save the output of your program. For example, let’s say you wanted to save the output of your nifty new “99 Bottles of Beer on the Wall” program. All you have to do is add a little bit onto the command line when you run it:

ruby 99bottles.rb > lyrics.txt

That’s not even really programming; that’s just a command-line trick. And it’s not a terribly exciting one, since you can’t really use it for a program with any kind of interactivity or to save to more than one file or to save at a time other than the end of the program…. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learn to Program, 3rd Edition

Learn to Program, 3rd Edition

Chris Pine
The Book of Ruby

The Book of Ruby

Huw Collingbourne

Publisher Resources

ISBN: 9781680500172Errata