2 SIMPLE SCRIPTS

This chapter covers everything you’ll need to know when it comes to writing and executing Ruby scripts. Although the interactive Ruby shell (irb), covered in Chapter 1, “Getting Started,” is a wonderful learning and practice tool, running saved files of Ruby code is the greater goal.

Along with the steps for creating a simple Ruby script, you’ll learn multiple ways of running it, how to output data (text and numbers), and how to take keyboard-supplied input. The chapter concludes by discussing Ruby’s syntax for adding comments to code. The information presented here is pretty simple but will be required for many of the later chapters.

Get Ruby: Visual Quickstart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.