4 ARRAYS, RANGES, AND HASHES

Chapter 3, “Simple Types,” concentrates on the most basic kinds of data used in Ruby, primarily numbers and strings. I call these simple types because such variables represent only a single value. In this chapter you’ll learn ways to represent multiple values using just one variable. These more complex data types include arrays, ranges, and hashes.

In the examples, you’ll learn how to create variables of these types, add and remove values, and manipulate them using different methods. In Chapter 5, “Control Structures,” you’ll see how to iterate through these types, accessing the individual values one at a time. How to create and use the most important complex data type—objects—will be discussed in Chapter 7, “

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.