Created
January 4, 2022 20:12
-
-
Save ayeshLK/3aa46b5377bc28e88ed003d462d67ded 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
function factorial(int n) returns int { | |
int result = 1; | |
// iterates over values starting from `1` to `n` | |
foreach int value in 1..< n+1 { | |
result *= value; | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment