PowerShell inline If (IIf)

后端 未结 7 2007
独厮守ぢ
独厮守ぢ 2020-12-07 16:24

How do I create an a statement with an inline If (IIf, see also: Immediate if or ternary If) in PowerShell?

If you also think that this should be a native Po

7条回答
  •  情深已故
    2020-12-07 17:19

    Here is another way:

    $condition = $false
    
    "The condition is $(@{$true = "true"; $false = "false"}[$condition])"
    

提交回复
热议问题