What are Symbols in Ruby?

Symbols are immutable, reusable names represented with a colon :.
They are faster and consume less memory than strings.

:age   # symbol
"age"  # string

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *