Project 2

Big Numbers

When you installed Ruby, a number of tools were placed on your computer. You’ll use many of these tools time and time again as you learn to program. In this project, I show you how you can use a combination of your terminal program and Interactive Ruby to do quick experiments that let you try new things with Ruby.

You’ll start at the very beginning and explore some of the most basic things you might ask a computer to do by exploring numbers, simple math, and storing results in the computer’s memory using variables.

You probably didn’t think Ruby could be used as a calculator for gigantic numbers, did you?

image

Starting Interactive Ruby

This project is completed entirely within your terminal (or console) program and uses Interactive Ruby (known as IRB or irb).

technicalstuff In this book, I refer to the language Ruby with an initial capital letter (as a name) and lowercase ruby to mean the Ruby command. Likewise, I use IRB to mean the name of the program, and irb to mean the command.

To get ready for this project, locate your terminal program (on the Mac) or the console with Ruby shortcut (on Windows). When that’s running, everything else is the same.

remember I use the term terminal ...

Get Ruby For Kids For Dummies 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.