DrSchool Learn coding, fast.
EN AR BN CS DE EL Search

Recursion — Example 97

Quick explanation + ready code for: Recursion.

PowerShell Recursion Back to examples
Back to language
Syntax: Recursion in PowerShell. ID: #97

Code

function Fact($n){ if($n -le 1){1}else{$n*(Fact($n-1))} }
Fact 5

Notes

You can copy this snippet and adapt it. For advanced, add real-world inputs, edge cases, and tests.