Ruby has three classes of variables, one constant, and two strict pseudo variables (pseudo-variables). There are no types for variables and constants. Although there are some drawbacks to the untyped variable, there are more advantages and good compliance with Ruby's quick and easy (quick) Philosophical spirit.
In most languages, a variable must specify its type, the change (not a constant), and the scope; Because the type does not exist, the rest can be determined quickly by the variable name (which you'll see right away) and we don't need a variable declaration in Ruby.
Classify it by a first-letter identifier:
$ global variable
@ Real Variable
[A-z] local variables
[A-Z] constant
The only exception is Ruby's pseudo variable: self, which always points to the currently executing object or the null value of the uninitialized variable (meaningless value) nil. Although both names are like local variables, self is a global variable controlled by the interpreter, and nil is actually a constant. Since there are only two kinds of accidents, they will not disturb us too much.
You can assign values to self or nil. In the following example, main, as the value of self, points to the object at the highest level:
Ruby> self
main
ruby> Nil
Nil