#!/usr/bin/env ruby -w # # Add a "factorial" method to Integer # "Learn to Program" by Chris Pine, p. 117 # class Integer def factorial if self == 0 1 else self * (self - 1).factorial end end end for i in (1..100) puts i.factorial end