Ruby: Symbols Flashcards

1
Q

Symbol Definition

A

Symbols are simply constant names that you don’t have to predeclare and that are guaranteed to be unique. A symbol literal starts with a colon and is normally followed by some kind of name:
:north
:east

There’s no need to assign some kind of value to a symbol—Ruby takes care of that for you. Ruby also guarantees that no matter where it appears in your program, a particular symbol will have the same value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly