From: Phillip Gawlowski Date: 2011-08-02T05:32:15+09:00 Subject: Re: newbie question On Mon, Aug 1, 2011 at 10:08 PM, Marc Chanliau wrote: > > class Factorial >  def fact(n) >    return 1 if n == 0 >    n * fact(n-1) >  end > end > > my_fact = Factorial.new > print "enter a positive integer: " > my_fact = gets.to_i > puts "factorial: #{fact(my_fact)}" Let's fix your code: class Factorial # Same as your original. end factorial = Factorial.new # Creating a new Factorial instance print "enter a positive integer: " num = gets.to_i # Assigning input to its own variable! puts "Factorial: #{factorial.fact(num)}" # calling the fact-method of your Factorial instance -- Phillip Gawlowski phgaw.posterous.com | twitter.com/phgaw | gplus.to/phgaw A method of solution is perfect if we can forsee from the start, and even prove, that following that method we shall attain our aim.               -- Leibniz