Fonctions récursive en Powershell
0x01. FACTORIELLE
############################################################################################################### # Language : PowerShell 2.0 # Filename : Get-Factorielle.ps1 # Autor : SecureInfo42 # Description : Compute factoriel with recursive function # Repository : - ###############################################################################################################
function factorielle($n) { if( $n -eq 1 ) { return($n) } return( ($n) * ( factorielle ($n-1) ) ); } factorielle 6
0x02. SIGMA
############################################################################################################### # Language : PowerShell 2.0 # Filename : Get-Sigma.ps1 # Autor : SecureInfo42 # Description : Compute sigma (sum) with recursive function # Repository : - ###############################################################################################################
function sigma($n) { if( $n -eq 1 ) { return($n) } return( ($n) * ( sigma ($n-1) ) ); } sigma 6
=> Écrit par : Nicolas, le 04 juillet 2017