H
hawat.thufir
For the following:
C:\Documents and Settings\nsaunders\Desktop>
C:\Documents and Settings\nsaunders\Desktop>type HelloWorld.rb
#5.times { print "Odelay!" }
def fact(n)
if n <= 1
1
else
n * fact(n - 1)
end
print n
end
C:\Documents and Settings\nsaunders\Desktop>
C:\Documents and Settings\nsaunders\Desktop>HelloWorld.rb
C:\Documents and Settings\nsaunders\Desktop>
C:\Documents and Settings\nsaunders\Desktop>HelloWorld.rb
1C:/Documents and Settings/nsaunders/Desktop/HelloWorld.rb:10:in `*':
nil can't
be coerced into Fixnum (TypeError)
from C:/Documents and Settings/nsaunders/Desktop/HelloWorld.rb:
10:in `fa
ct'
from C:/Documents and Settings/nsaunders/Desktop/HelloWorld.rb:
10:in `fa
ct'
from C:/Documents and Settings/nsaunders/Desktop/HelloWorld.rb:
17
C:\Documents and Settings\nsaunders\Desktop>
C:\Documents and Settings\nsaunders\Desktop>
Does there need to be class defined to call the method?
thanks,
Thufir
C:\Documents and Settings\nsaunders\Desktop>
C:\Documents and Settings\nsaunders\Desktop>type HelloWorld.rb
#5.times { print "Odelay!" }
def fact(n)
if n <= 1
1
else
n * fact(n - 1)
end
print n
end
C:\Documents and Settings\nsaunders\Desktop>
C:\Documents and Settings\nsaunders\Desktop>HelloWorld.rb
C:\Documents and Settings\nsaunders\Desktop>
C:\Documents and Settings\nsaunders\Desktop>HelloWorld.rb
1C:/Documents and Settings/nsaunders/Desktop/HelloWorld.rb:10:in `*':
nil can't
be coerced into Fixnum (TypeError)
from C:/Documents and Settings/nsaunders/Desktop/HelloWorld.rb:
10:in `fa
ct'
from C:/Documents and Settings/nsaunders/Desktop/HelloWorld.rb:
10:in `fa
ct'
from C:/Documents and Settings/nsaunders/Desktop/HelloWorld.rb:
17
C:\Documents and Settings\nsaunders\Desktop>
C:\Documents and Settings\nsaunders\Desktop>
Does there need to be class defined to call the method?
thanks,
Thufir