From: Robert Klemme Date: 2013-04-12T00:07:26+09:00 Subject: Re: confusion with Struct class --047d7b6219fecaf43704da17246f Content-Type: text/plain; charset=ISO-8859-1 On Thu, Apr 11, 2013 at 4:59 PM, Love U Ruby wrote: > Robert Klemme wrote in post #1105267: > > On Thu, Apr 11, 2013 at 4:27 PM, Love U Ruby > > wrote: > > > > > irb(main):006:0> 5.times { puts joe.hash } > > 1060632465 > > 1060632465 > > 1060632465 > > 1060632465 > > 1060632465 > > => 5 > > For me now it is also OK. I don't know why I got such bullshit output > earlier? > > p RUBY_VERSION > Customer = Struct.new(:name, :address, :zip) > joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345) > p 5.times { puts joe.hash } > p joe.hash > p joe.hash > > Output: > > "1.9.3" > -672312861 > -672312861 > -672312861 > -672312861 > -672312861 > 5 > -672312861 > 8577108 > -672312861 > 8577108 > > That output doesn't fit the program. Where do lines with "8577108" come from? Also "p 5.times ..." doesn't make sense. robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/ --047d7b6219fecaf43704da17246f Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable



On Thu, Apr 11, 2013 at 4:59 PM, Love U Ruby <= lists@ruby-forum.= com> wrote:
Robert Klemme wrote in post #1105267:
> On Thu, Apr 11, 2013 at 4:27 PM, Love U Ruby <lists@ruby-forum.com>
> wrote:
>

> irb(main):006:0> 5.times { puts joe.hash }<= br> > 1060632465
> 1060632465
> 1060632465
> 1060632465
> 1060632465
> =3D> 5

For me now it is also OK. I don't know why I got such bullshit ou= tput
earlier?

p RUBY_VERSION
Customer =3D Struct.new(:name, :address, :zip)
joe =3D Customer.new("Joe Smith", "123 Maple, Anytown NC&quo= t;, 12345)
p 5.times { puts joe.hash }
p joe.hash
p joe.hash

Output:

"1.9.3"
-672312861
-672312861
-672312861
-672312861
-672312861
5
-672312861
8577108
-672312861
8577108


That output doesn't fit the program. =A0Where do lines wi= th "857710= 8" come from?

=
Also "p 5.times ..." doesn't make sense.

=
robert


--
remember.guy do |as, often| a= s.you_can - without end
h= ttp://blog.rubybestpractices.com/
--047d7b6219fecaf43704da17246f--