Created
August 26, 2010 17:10
-
-
Save nobeans/551790 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
fact = { n -> | |
isEnd = n <= 1 | |
work = isEnd ? 1 : fact(n - 1) | |
result = n * work as long | |
} | |
max = args[0] as long | |
range = 1..max | |
range.each { num -> | |
fact num | |
println "$num! => $result" | |
} |
Author
nobeans
commented
Aug 26, 2010
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment