PSEC - Powershell Enhanced Capability
Version 1.2.1

tern (src: start-psec-v4.ps1)

Signature

[UKN] tern ( [boolean]$cond, [any]$val, [any]$notVal)

Parameters

Parameter Format Description

$cond boolean parm description missing

$val any parm description missing

$notVal any parm description missing

Description

Terniary replacement. Return $val if $cond true, else $notVal

Notes

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);

PSEC - Powershell Enhanced Capability
1.2.1

Copyright © 2018-2021, 2022, Rexcel System Inc.

 

 

 

 

 

X