Skip to content

Instantly share code, notes, and snippets.

@raucao
Created May 15, 2012 13:39
Show Gist options
  • Save raucao/2701857 to your computer and use it in GitHub Desktop.
Save raucao/2701857 to your computer and use it in GitHub Desktop.
Ruby symbols vs strings
ruby-1.9.3-preview1 :001 > somesymbol = :hithere
=> :hithere
ruby-1.9.3-preview1 :002 > someothersymbol = :hithere
=> :hithere
ruby-1.9.3-preview1 :003 > somestring = "hithere"
=> "hithere"
ruby-1.9.3-preview1 :004 > someotherstring = "hithere"
=> "hithere"
ruby-1.9.3-preview1 :005 > somesymbol.object_id
=> 459688
ruby-1.9.3-preview1 :006 > someothersymbol.object_id
=> 459688
ruby-1.9.3-preview1 :007 > somestring.object_id
=> 70108038934980
ruby-1.9.3-preview1 :008 > someotherstring.object_id
=> 70108039637960
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment