Skip to content

Instantly share code, notes, and snippets.

@ayeshLK
Created January 4, 2022 20:12
Show Gist options
  • Save ayeshLK/3aa46b5377bc28e88ed003d462d67ded to your computer and use it in GitHub Desktop.
Save ayeshLK/3aa46b5377bc28e88ed003d462d67ded to your computer and use it in GitHub Desktop.
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