Skip to Content
Polished Ruby Programming
book

Polished Ruby Programming

by Jeremy Evans
July 2021
Intermediate to advanced
434 pages
8h 36m
English
Packt Publishing
Content preview from Polished Ruby Programming

Chapter 3: Proper Variable Usage

Anytime you need to store information in a Ruby program and access it later, you will be using some sort of variable. Which types of variables you use has a significant effect on your program's performance and maintainability. In this chapter, you'll learn about Ruby's different variable types and the advantages of using and naming them properly.

We will cover the following topics:

  • Using Ruby's favorite variable type – the local variable
  • Learning how best to use instance variables
  • Understanding how constants are just a type of variable
  • Replacing class variables
  • Avoiding global variables, most of the time

By the end of this chapter, you'll have a better understanding of the different types of variables and how ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming Ruby 3.3

Programming Ruby 3.3

Noel Rappin, Dave Thomas
The Ruby Programming Language

The Ruby Programming Language

David Flanagan, Yukihiro Matsumoto

Publisher Resources

ISBN: 9781801072724Supplemental Content