Skip to content

Instantly share code, notes, and snippets.

@MathieuBuisson
Created August 17, 2017 13:31
Show Gist options
  • Select an option

  • Save MathieuBuisson/997391c2bf5e5480fce5add401cfb4ee to your computer and use it in GitHub Desktop.

Select an option

Save MathieuBuisson/997391c2bf5e5480fce5add401cfb4ee to your computer and use it in GitHub Desktop.
Dummy function to test PowerShell code complexity measurement
Function Test-Conditional {
[CmdletBinding()]
Param(
[int]$IfElseif
)
# Testing nested If statement
If ( $IfElseif -gt 20 ) {
If ( $IfElseif -gt 40 ) {
Write-Host 'IfElseif is between 20 and 40'
}
Else {
Write-Host 'IfElseif is greater than 40'
}
}
Else {
If ( $IfElseif -ge 10 ) {
Write-Host 'IfElseif is a 2 digit number'
}
Else {
#Testing For statements
For ($i = 1; $i -lt 99; $i++) {
Write-Host "$($IfElseif + $i)"
For ($j = 0; $j -lt 10; $j++) {
Write-Host "$($IfElseif - $j)"
}
}
For ($k = 1;;$k++) {
Write-Host 'No Condition for this loop'
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment