-
Book Overview & Buying
-
Table Of Contents
Polished Ruby Programming - Second Edition
By :
Ruby's favorite variable type is the local variable. Local variables are the only variable type that doesn't require you to use a sigil (for example, @ or $) or use capitalization. This is not by accident, this is by design, to nudge you toward using local variables as much as possible.
In this section, you'll learn about how to improve performance by adding local variables (when it's safe to do so), and about issues involving scope gates, and the importance of local variable naming.
You may be wondering why it is better to use local variables than other variable types. This is because local variables require the least indirection. When you access a local variable, the Ruby virtual machine knows the location of the local variable, and needs to do less work to access the memory. In most cases, the local variables are stored on the virtual machine stack, which...
Change the font size
Change margin width
Change background colour