Back to Developer Roadmap

Symbols

src/data/roadmaps/ruby/content/symbols@U-V-MNSnIL17Imug_iFvE.md

4.0902 B
Original Source

Symbols

Symbols are lightweight, immutable strings often used as identifiers or names within a Ruby program. Unlike regular strings, symbols are guaranteed to be unique; Ruby only creates one copy of a symbol, regardless of how many times it's referenced. This makes them efficient for tasks like hash keys or representing states, where comparing identity is more important than comparing content. They are typically written with a colon prefix, like :my_symbol.

Visit the following resources to learn more: