On Sun, Dec 23, 2012 at 7:40 AM, 7stud -- <[email protected]> wrote:
> x = "hello"
> y = "hello"
>
> puts x.object_id
> puts y.object_id
>
> --output:--
> 2151872720
> 2151872540
>
> Quote marks are a String object constructor in ruby.

Maybe a bit more illustrative: executing the _same_ string literal
results in multiple different instances:

irb(main):001:0> 4.times { puts "foo".object_id }
73580460
73580430
73580410
73580370
=> 4

Kind regards

robert


--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

-- You received this message because you are subscribed to the Google Groups 
ruby-talk-google group. To post to this group, send email to 
[email protected]. To unsubscribe from this group, send email 
to [email protected]. For more options, visit this 
group at https://groups.google.com/d/forum/ruby-talk-google?hl=en

Reply via email to