[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

prob with tutorial example

shawn bright

8/8/2006 1:22:00 PM

Hey there,
just got the pickaxe book, and i am working thru the beginning.

one example prog is this

#!/usr/bin/ruby

def fib_up_to(max)
i1, i2 = 1, 1
while i1 <= max
yeild i1
i1, i2 = i2, i1 + i2
end
end

fib_up_to(1000) {|f| print f, " "}

when i try to execute it from a terminal, i get this:

../testl.rb:6:in `fib_up_to': undefined method `yeild' for main:Object
(NoMethodError)
from ./test.rb:11

am i doing something wrong? i have this installed in debian sarge.

thanks

9 Answers

Robert Klemme

8/8/2006 1:27:00 PM

0

On 08.08.2006 15:22, nephish wrote:
> Hey there,
> just got the pickaxe book, and i am working thru the beginning.
>
> one example prog is this
>
> #!/usr/bin/ruby
>
> def fib_up_to(max)
> i1, i2 = 1, 1
> while i1 <= max
> yeild i1
> i1, i2 = i2, i1 + i2
> end
> end
>
> fib_up_to(1000) {|f| print f, " "}
>
> when i try to execute it from a terminal, i get this:
>
> ./testl.rb:6:in `fib_up_to': undefined method `yeild' for main:Object
> (NoMethodError)
> from ./test.rb:11
>
> am i doing something wrong? i have this installed in debian sarge.
>
> thanks
>

Typo: "yeild" should read "yield".

robert

shawn bright

8/8/2006 1:28:00 PM

0


nephish wrote:
> Hey there,
> just got the pickaxe book, and i am working thru the beginning.
>
> one example prog is this
>
> #!/usr/bin/ruby
>
> def fib_up_to(max)
> i1, i2 = 1, 1
> while i1 <= max
> yeild i1
> i1, i2 = i2, i1 + i2
> end
> end
>
> fib_up_to(1000) {|f| print f, " "}
>
> when i try to execute it from a terminal, i get this:
>

geez, nevermind. guess it would help to spell yield correctly !
-sk
> ./testl.rb:6:in `fib_up_to': undefined method `yeild' for main:Object
> (NoMethodError)
> from ./test.rb:11
>
> am i doing something wrong? i have this installed in debian sarge.
>
> thanks

dblack

8/8/2006 1:29:00 PM

0

Ben Nagy

8/8/2006 1:29:00 PM

0

'i' before 'e', except after 'c'.

ben

> -----Original Message-----
> From: nephish [mailto:nephish@gmail.com]
> Sent: Tuesday, August 08, 2006 8:25 PM
> To: ruby-talk ML
> Subject: prob with tutorial example
>
> Hey there,
> just got the pickaxe book, and i am working thru the beginning.
>
> one example prog is this
>
> #!/usr/bin/ruby
>
> def fib_up_to(max)
> i1, i2 = 1, 1
> while i1 <= max
> yeild i1
> i1, i2 = i2, i1 + i2
> end
> end
>
> fib_up_to(1000) {|f| print f, " "}
>
> when i try to execute it from a terminal, i get this:
>
> ./testl.rb:6:in `fib_up_to': undefined method `yeild' for main:Object
> (NoMethodError)
> from ./test.rb:11
>
> am i doing something wrong? i have this installed in debian sarge.
>
> thanks
>
>


Karl von Laudermann

8/8/2006 1:29:00 PM

0

nephish wrote:

> when i try to execute it from a terminal, i get this:
>
> ./testl.rb:6:in `fib_up_to': undefined method `yeild' for main:Object
> (NoMethodError)
> from ./test.rb:11
>
> am i doing something wrong? i have this installed in debian sarge.

Offhand, I'd say you misspelled "yield". :-)

James Gray

8/8/2006 1:30:00 PM

0

On Aug 8, 2006, at 8:25 AM, nephish wrote:

> Hey there,
> just got the pickaxe book, and i am working thru the beginning.
>
> one example prog is this
>
> #!/usr/bin/ruby
>
> def fib_up_to(max)
> i1, i2 = 1, 1
> while i1 <= max
> yeild i1
> i1, i2 = i2, i1 + i2
> end
> end
>
> fib_up_to(1000) {|f| print f, " "}
>
> when i try to execute it from a terminal, i get this:
>
> ./testl.rb:6:in `fib_up_to': undefined method `yeild' for main:Object
> (NoMethodError)
> from ./test.rb:11

It's a spelling error. Try "yield." ;)

James Edward Gray II

shawn bright

8/8/2006 1:37:00 PM

0


Ben Nagy wrote:
> 'i' before 'e', except after 'c'.
>
> ben
>
> > -----Original Message-----
> > From: nephish [mailto:nephish@gmail.com]
> > Sent: Tuesday, August 08, 2006 8:25 PM
> > To: ruby-talk ML
> > Subject: prob with tutorial example
> >
> > Hey there,
> > just got the pickaxe book, and i am working thru the beginning.
> >
> > one example prog is this
> >
> > #!/usr/bin/ruby
> >
> > def fib_up_to(max)
> > i1, i2 = 1, 1
> > while i1 <= max
> > yeild i1
> > i1, i2 = i2, i1 + i2
> > end
> > end
> >
> > fib_up_to(1000) {|f| print f, " "}
> >
> > when i try to execute it from a terminal, i get this:
> >
> > ./testl.rb:6:in `fib_up_to': undefined method `yeild' for main:Object
> > (NoMethodError)
> > from ./test.rb:11
> >
> > am i doing something wrong? i have this installed in debian sarge.
> >
> > thanks
> >
> >

thanks, gents. i don't mean to waste fellow coders time. I am new to
ruby (installed it yesterday) and i thought something was wrong with my
interpreter. Now i think something is wrong with my keyboard. I find
that in most of my code, a problem is usually traced to somewhere
between the keyboard and the chair .

thanks,
-sk

Logan Capaldo

8/8/2006 2:01:00 PM

0


On Aug 8, 2006, at 9:25 AM, nephish wrote:

> Hey there,
> just got the pickaxe book, and i am working thru the beginning.
>
> one example prog is this
>
> #!/usr/bin/ruby
>
> def fib_up_to(max)
> i1, i2 = 1, 1
> while i1 <= max
> yeild i1
> i1, i2 = i2, i1 + i2
> end
> end
>
> fib_up_to(1000) {|f| print f, " "}
>
> when i try to execute it from a terminal, i get this:
>
> ./testl.rb:6:in `fib_up_to': undefined method `yeild' for main:Object
> (NoMethodError)
> from ./test.rb:11
>
> am i doing something wrong? i have this installed in debian sarge.
>
> thanks
>
>

:) You have misspelled "yield".

HTH


Robert Klemme

8/8/2006 3:05:00 PM

0

On 08.08.2006 15:36, nephish wrote:
> thanks, gents. i don't mean to waste fellow coders time. I am new to
> ruby (installed it yesterday) and i thought something was wrong with my
> interpreter. Now i think something is wrong with my keyboard. I find
> that in most of my code, a problem is usually traced to somewhere
> between the keyboard and the chair .

So it's in your belly? :-)

robert