File: openclass.rb

Project: Invitation to Ruby

#!/usr/bin/env ruby

class Integer
  def fact
    return 1 if self == 0
    self * (self-1).fact
  end
end

puts 55.fact


[ Index ][ Table of Contents ]
Generated by [ source2html ]