Ruby: My Gem

Haha, Ruby
Photo by Joshua Fuller on Unsplash

Ruby symbols & strings

Symbols

:symbol_name #syntax

hash = {a: 1, b: 2, c: 3} #can be used as hash keys

A symbol is immutable, increases the speed, and has unique object id.. (reference)

Symbols are not a pointer to values, they are values themselves

to_sym (Convert to a symbol)

to_s (Convert to a string)

--

--

UI/UX Designer, Software Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store