> The following appeared in chapter 3 of the Ruby's User Guide: > def fact(n) > if n == 0 > 1 > else > n * fact(n-1) > end > end > Is everything OK here? The function is defined on natural numbers (0 and its successors). If this is a given, then yes, the above definition is correct. Using the FAQ's inject function, you may also write: def fact(n) (1..n).inject(1) {|a,b| a * b } end Mathieu Bouchard