What is the difference between: and & ldquo; & Rdquo; In the Ruby hashes?

advertisements

I see some people using hash(es) like this:

end_points = { "dev" => "http://example.com"}

and in other places using this:

 end_points = { :dev => "http://example.com"}

What is the difference between these two approaches?


"" declares a String. : declares a Symbol. If you're using a hash, and you don't need to alter the key's value or keep it around for anything, use a symbol.

Check this out for a more elaborate explanation.