3 SIMPLE TYPES

In this chapter the book starts covering the various types of data that one might work with in Ruby. Although everything in Ruby is, in fact, an object, knowing what you can do with, for example, an object of type String, and how that differs from an object of type Fixnum (a numeric type) is important. This chapter addresses what I call simple types: objects that will contain but a single value—one number, one string of text, one moment in time.

In order to pick these concepts up most quickly, the examples will be demonstrated using the command line irb (or fxri on Windows, if you prefer). If you’d rather create Ruby scripts, you can always take the information in this chapter to come up with your own practice scripts.

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.