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 methodyeild’ for main:Object
(NoMethodError)
from ./test.rb:11

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

thanks

Hi –

On Tue, 8 Aug 2006, nephish wrote:

yeild i1
from ./test.rb:11

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

You’re misspelling ‘yield’ :slight_smile:

David

‘i’ before ‘e’, except after ‘c’.

ben

nephish wrote:

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

On 08.08.2006 15:22, nephish wrote:

yeild i1
    from ./test.rb:11

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

thanks

Typo: “yeild” should read “yield”.

robert

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

yeild i1
    from ./test.rb:11

It’s a spelling error. Try “yield.” :wink:

James Edward G. II

nephish wrote:

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

./testl.rb:6:in fib_up_to': undefined methodyeild’ 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”. :slight_smile:

Ben N. wrote:

Hey there,
i1, i2 = i2, i1 + i2

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

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

yeild i1
    from ./test.rb:11

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

thanks

:slight_smile: You have misspelled “yield”.

HTH

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? :slight_smile:

robert

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs