Created
December 12, 2015 04:20
-
-
Save carlosbrando/be9cb99918d248caf7e6 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
class MyTest | |
def factorial(n) | |
f = 1 | |
n.downto(2) { |x| f *= x } | |
f | |
end | |
inline do |builder| | |
builder.c " | |
long factorial_c(int max) { | |
int i=max, result=1; | |
while (i >= 2) { result *= i--; } | |
return result; | |
}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment