prob with tutorial example

N

nephish

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
 
R

Robert Klemme

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
 
N

nephish

nephish said:
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
 
D

dblack

Hi --

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.

You're misspelling 'yield' :)


David

--
http://www.rubypowerandlight.com => Ruby/Rails training & consultancy
----> SEE SPECIAL DEAL FOR RUBY/RAILS USERS GROUPS! <-----
http://dablog.rubypal.com => D[avid ]A[. ]B[lack's][ Web]log
http://www.manning.com/black => book, Ruby for Rails
http://www.rubycentral.org => Ruby Central, Inc.
 
K

Karl von Laudermann

nephish said:
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". :)
 
J

James Edward Gray II

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
 
N

nephish

Ben said:
'i' before 'e', except after 'c'.

ben
-----Original Message-----
From: nephish [mailto:[email protected]]
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
 
L

Logan Capaldo

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
 
R

Robert Klemme

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top