Created
June 23, 2019 09:13
-
-
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
This file contains hidden or 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($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