Skip to content

Instantly share code, notes, and snippets.

@psygo
Last active August 8, 2020 21:16
Show Gist options
  • Save psygo/60bbfdb179afc9dea7c3d268aa51e943 to your computer and use it in GitHub Desktop.
Save psygo/60bbfdb179afc9dea7c3d268aa51e943 to your computer and use it in GitHub Desktop.
The Most Succinct Form Factorial Function
/// 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