Variables

Symbols in Ruby

A symbol is an identifier whose name is immutable (cannot be changed at runtime).


Syntax
:symbol_name

Notes

These are used to convey states or specific values. Symbols are popular with key-value store for hash tables.


Example
state = :changed

See Also
Related

Hashes

Documentation

Class: Symbol - Ruby Docs

Add to Slack

< Arrays   |   Hashes >

© 2019 SyntaxDB. All Rights Reserved.