June 2017
Beginner
330 pages
7h 30m
English
If you're coming from other programming languages, Ruby handles constants differently than what you may be used to. Constants, in general, take values that do not change through the entire application. The syntax is to use all capital letters while naming your constant so that the application knows how to handle it. For example, to set a constant to hold a baseball team, you would declare it this way:
TEAM = "Angels"
Typically, other programming languages will not allow you to change the value of TEAM. However, Ruby does not hold you back, and it takes the last value assigned to the constant. In the preceding example, I can change its value to:
TEAM = "Athletics"
Other programming languages would either throw an error or would ...
Read now
Unlock full access