Chapter 11. Symbols
Many newcomers to Ruby are confused by symbols. A symbol is an identifier whose first character is a colon (
:this is a symbol and so is
:that. Symbols are, in fact, not at all complicated—and, in certain circumstances, they may be extremely useful, as you will see shortly.
Let’s first be clear about what a symbol is not: It is not a string, it is not a constant, and it is not a variable. A symbol is, quite simply, an identifier with no intrinsic meaning other than its own name. Whereas you might assign a value to a variable like this . . .
name = "Fred"
you would not assign a value to a symbol:
:name = "Fred" # Error!
The value ...