Why Ruby has Symbols
07-Apr-2022 1826
Many people who come to Ruby start using symbols on their first day. Come on, Getting Started with Rails shows you symbols in the first migration you generate! From the first glance, symbols look like strings (:hi versus "hi") and can be converted back and forth. The naive explanation of their difference is that strings are used to represent some data (e.g., constant or variable values), while symbols usually appear as a part of the code (e.g., arguments of method calls). However, why do we have both? Let’s figure that out!.
Why Ruby has Symbols #ruby #rubydeveloper #rubyonrails #Symbols https://rubyonrails.ba/link/why-ruby-has-symbols