From: Marc Chanliau Date: 2011-08-01T08:41:50+09:00 Subject: newbie question This snippet works fine: def fact(n) if n == 0 1 else n * fact(n-1) end end result = fact(4) puts "The factorial of the number 4 is: " + result.to_s Now, I want to make the snippet above interactive and allow the user to enter a number and get in return the factorial for that number. The following snippet doesn't work, what am I doing wrong? def fact(n) if n == 0 1 else n * fact(n-1) end end puts "enter a positive integer: " n = gets puts "factorial: " + fact(n) -- Posted via http://www.ruby-forum.com/.