Skip to content

Instantly share code, notes, and snippets.

@AspenForester
Last active April 29, 2020 13:10
Show Gist options
  • Save AspenForester/018fec337ff494638d77555a745c4846 to your computer and use it in GitHub Desktop.
Save AspenForester/018fec337ff494638d77555a745c4846 to your computer and use it in GitHub Desktop.
Factorial with PowerShell
function Factorial ([bigint]$x)
{
if ($x -ge 1)
{
return $x * (Factorial ($x = $x - 1))
}
elseif ($x -eq 0)
{
return 1
}
else
{
throw "NaN"
}
}
@dfinke
Copy link

dfinke commented Apr 28, 2020

Thanks for posting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment