public/IIf.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
function IIf { [CmdletBinding()] param ( # Condition [Parameter(Mandatory,Position=0)] [bool] $Condition, # Value if true [Parameter(Mandatory,Position=1)] [AllowNull()] [object] $TrueValue, # Value if false [Parameter(Mandatory,Position=2)] [AllowNull()] [object] $FalseValue ) process { if ($Condition) {$TrueValue} else {$FalseValue} } } |