[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Newbie question

Len Sumnler

11/9/2003 7:35:00 AM

I am just starting to learn Ruby. I am running Ruby under XP and have
entered a code example from the book "Programming Ruby The Pragmatic
Programmer's Guide".
Code example follows;

class Song
def intialize(name, artist, duration)
@name = name
@artist = artist
@duration = duration
end
end

aSong = Song.new("Hey Jude", "Beetles", 260)
aSong.inspect

I get the following error messages.

My_Class.rb:9:in `initialize': wrong number of arguments(3 for 0)
(ArgumentError)
from My_Class.rb:9:in `new'
from My_Class.rb:9

WHY

Len Sumnler


2 Answers

Christian Loew

11/9/2003 8:33:00 AM

0

followup to Len Sumnler's posting
> I am just starting to learn Ruby. I am running Ruby under XP and have
> entered a code example from the book "Programming Ruby The Pragmatic
> Programmer's Guide".
> Code example follows;
>
> class Song
> def intialize(name, artist, duration)
^^^^
missing 'i'


Chris

Len Sumnler

11/9/2003 4:02:00 PM

0

Sorry for the stupid question it was just to late.

Thanks for the second pair of eyes though
Len Sumnler

"Christian Loew" <cloew.nospam@chello.at> wrote in message
news:boku3d$1f1ddh$1@ID-114121.news.uni-berlin.de...
> followup to Len Sumnler's posting
> > I am just starting to learn Ruby. I am running Ruby under XP and have
> > entered a code example from the book "Programming Ruby The Pragmatic
> > Programmer's Guide".
> > Code example follows;
> >
> > class Song
> > def intialize(name, artist, duration)
> ^^^^
> missing 'i'
>
>
> Chris