O'Reilly logo

Ruby by Example by Kevin C. Baird

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 5. Number Utilities

image with no caption

Numbers are fundamental for all computers and programming languages, and Ruby is no exception. In this chapter’s scripts, we’ll deal with useful data that is primarily numeric but is otherwise quite diverse. We’ll explore some pure math, following up with recursion, which I introduced in Chapter 4. We’ll also do some type conversion, whereby numbers will be represented in different ways that are convenient for human users. We’ll also do some unit conversion, specifically monetary units.[12] While doing all of this, we’ll also delve further into metaprogramming, Hashes, using external libraries, and two distinct formats ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required