Skip to content

Instantly share code, notes, and snippets.

@Weiyuan-Lane
Created June 23, 2019 09:13
Show Gist options
  • Save Weiyuan-Lane/c4aa57b18863e4635db2e3c095645294 to your computer and use it in GitHub Desktop.
Save Weiyuan-Lane/c4aa57b18863e4635db2e3c095645294 to your computer and use it in GitHub Desktop.
Code for implementing factorial (with precomputed inputs for removing the need to repeat previous computations
@function factorial($endAt, $startAt: 1, $currentVal: 1) {
$accVal: $currentVal;
@for $i from $startAt + 1 to $endAt + 1 {
$accVal: $i * $accVal;
}
@return $accVal;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment