[UKN] tern ( [boolean]$cond, [any]$val, [any]$notVal)
Parameter Format Description
$cond boolean parm description missing
$val any parm description missing
$notVal any parm description missing
Terniary replacement. Return $val if $cond true, else $notVal
To force a Condition (boolean) result sometimes the $cond operators need to be resequenced. Thus use ($null -eq $arr)
and not
($arr -eq $null)
(The $arr is assumed to be boolean).
Alternately it could be expressed in pure Powershell syntax. Thus:
$x = if (condition) {$true-val} else {$false-value}
$arr = (tern ($null -eq $arr) $vals $arr);
Copyright © 2018-2021, 2022, Rexcel System Inc.