Ternary operator

06/08/2012 19:00

First run following definition

 

 

 filter Invoke-Ternary ([scriptblock]
 $decider,[scriptblock]$iftrue,[scriptblock]$iffalse)
 {
 if (&$decider) { &$iftrue} else { &$iffalse }
 }
 
Then set alias for operator
 
set-alias ?: Invoke-Ternary -Option AllScope
 
Then you can use it
 
$b= ?: {$a -gt 5}{ "Hey"}{"bla"}