Last active
August 8, 2020 21:16
-
-
Save psygo/60bbfdb179afc9dea7c3d268aa51e943 to your computer and use it in GitHub Desktop.
The Most Succinct Form Factorial Function
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
/// Using `n == 1` won't work usually because the `n` input can be `0`. | |
int factorial(int n) => n == 0 ? 1 : n * factorial(n - 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment