[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Why the resutls are different

Victor 'Zverok' Shepelev

12/17/2006 3:31:00 PM

From: list-bounce@example.com [mailto:list-bounce@example.com] On Behalf Of
Li Chen
Sent: Sunday, December 17, 2006 5:17 PM
>
>I try to understand the concept of variable scopes. I define two classes
>with very similar structures. But Ruby complains class Y only. Any
>comments?
>
>Thanks,
>
>Li
>
>
>class X
> def initialize(name,artist,duration)
> @name=name
> @artist=artist
> @duration=duration
> end
> puts "This is the name"" #{name}"
>end
>
>test_x=X.new(1,2,3)
>puts test_x.inspect
>
>>ruby variables1.rb
>This is the name X
>#<X:0x28ae894 @artist=2, @name=1, @duration=3>
>>Exit code: 0
>
>
>class Y
> def initialize(arg1,arg2,arg3)
> @arg1=arg1
> @arg2=arg2
> @arg3=arg3
> end
> puts "This is arg1"" #{arg1}"
>end
>
> test_y=Y.new(1,2,3)
> puts test_y.inspect
>
>>ruby variables2.rb
>variables2.rb:15: undefined local variable or method `arg1' for Y:Class
>(NameError)
>>Exit code: 1
>

In the first case, "name" is threated as "X.name" (method "name" of object
"class X").

V.


6 Answers

Li Chen

12/17/2006 4:34:00 PM

0

Thank you all for the quick response.

Li

--
Posted via http://www.ruby-....

Too_Many_Tools

4/16/2013 3:15:00 AM

0

On Apr 15, 8:04 pm, Klaus Schadenfreude <klausschadenfre...@yahoo.com>
wrote:
> On Mon, 15 Apr 2013 16:58:55 -0700, "PrecisionmachinisT"
>
> <123machin...@notmail.com> wrote:
> >> A gun loon shooting himself..one of many such incidents that happen
> >> all the time.
>
> >Great news...
>
> >--the only good nut-job with a gun is a dead one !!!
>
> And you freaks wonder why we want guns.
>
> "POINT PROVEN!"
> Lee Harrison 1957-2012, RIP

And it looks like you need only ONE bullet.

That should make having small capacity magazines easier to stomach.

TMT

PrecisionmachinisT

4/16/2013 3:31:00 AM

0


"Klaus Schadenfreude" <klausschadenfreude@yahoo.com> wrote in message
news:ts8pm8l86qbbe936k8i290spucs1i2nt57@4ax.com...
> On Mon, 15 Apr 2013 16:58:55 -0700, "PrecisionmachinisT"
> <123machinist@notmail.com> wrote:
>
>
>>> A gun loon shooting himself..one of many such incidents that happen
>>> all the time.
>>>
>>
>>
>>Great news...
>>
>>--the only good nut-job with a gun is a dead one !!!
>
> And you freaks wonder why we want guns.
>

You're the freak.


Scout

4/16/2013 4:02:00 AM

0



"PrecisionmachinisT" <precisionmachinist123@notmail.com> wrote in message
news:-Lydnf3yIuiNW_HMnZ2dnUVZ_hmdnZ2d@scnresearch.com...
>
> "Klaus Schadenfreude" <klausschadenfreude@yahoo.com> wrote in message
> news:ts8pm8l86qbbe936k8i290spucs1i2nt57@4ax.com...
>> On Mon, 15 Apr 2013 16:58:55 -0700, "PrecisionmachinisT"
>> <123machinist@notmail.com> wrote:
>>
>>
>>>> A gun loon shooting himself..one of many such incidents that happen
>>>> all the time.
>>>>
>>>
>>>
>>>Great news...
>>>
>>>--the only good nut-job with a gun is a dead one !!!
>>
>> And you freaks wonder why we want guns.
>>
>
> You're the freak.

Says the person who wants a hundred million people to die simply because
they chose to exercise their Constitutional rights.



Too_Many_Tools

4/16/2013 5:44:00 AM

0

On Apr 15, 8:04 pm, Klaus Schadenfreude <klausschadenfre...@yahoo.com>
wrote:
> On Mon, 15 Apr 2013 16:58:55 -0700, "PrecisionmachinisT"
>
> <123machin...@notmail.com> wrote:
> >> A gun loon shooting himself..one of many such incidents that happen
> >> all the time.
>
> >Great news...
>
> >--the only good nut-job with a gun is a dead one !!!
>
> And you freaks wonder why we want guns.
>
> "POINT PROVEN!"
> Lee Harrison 1957-2012, RIP

Tell us why again you want guns...to shoot yourself?

Sounds like a case of mental illiness to me.

No Guns for You Klaus@!!!

TMT

Klaus Schadenfreude

4/16/2013 12:14:00 PM

0

On Mon, 15 Apr 2013 20:31:19 -0700, "PrecisionmachinisT"
<precisionmachinist123@notmail.com> wrote:

>
>"Klaus Schadenfreude" <klausschadenfreude@yahoo.com> wrote in message
>news:ts8pm8l86qbbe936k8i290spucs1i2nt57@4ax.com...
>> On Mon, 15 Apr 2013 16:58:55 -0700, "PrecisionmachinisT"
>> <123machinist@notmail.com> wrote:
>>
>>
>>>> A gun loon shooting himself..one of many such incidents that happen
>>>> all the time.
>>>>
>>>
>>>
>>>Great news...
>>>
>>>--the only good nut-job with a gun is a dead one !!!
>>
>> And you freaks wonder why we want guns.
>>
>
>You're [..]

correct, as usual