#!/usr/bin/env ruby # # rFactorial0.rb # # Victor Hanson-Smith (with mods by Steve Fickas) # QUESTIONS? -> {victorhs,fickas}@cs.uoregon.edu # # This Ruby script recursively computes the factorial of an integer. # def fact(n) if n < 0 puts "factorial is undefined for negative numbers\n" exit #Halts all computation. In essence, crashes. end if n == 0 1 else return n * fact(n-1) end end