Created
October 5, 2009 00:35
-
-
Save kakutani/201724 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'ruby-debug' | |
Debugger.start | |
def pow(x, n) | |
debugger if n == 1 # start debugger when n == 1 | |
raise if n < 0 | |
if n == 0 | |
return 1 | |
else | |
return pow(x, n - 1) * x | |
end | |
end | |
puts pow(ARGV[0].to_i, ARGV[1].to_i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment