Created
May 15, 2012 13:39
-
-
Save raucao/2701857 to your computer and use it in GitHub Desktop.
Ruby symbols vs strings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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