Technet's about_Logical_Operators with respect to Windows PowerShell 4.0 states the following:
Operator Description Example
-------- ------------------------------ ------------------------
-or Logical or. TRUE when either (1 -eq 1) -or (1 -eq 2)
or both statements are TRUE. True
-xor Logical exclusive or. TRUE (1 -eq 1) -xor (2 -eq 2)
only when one of the statements False
is TRUE and the other is FALSE.
Neither seem to perform short-circuit evaluation.
How can I mimic the C# ||
or VB OrElse
in Windows Powershell 4.0?
-or
operator. Keith Hill's answer shows that it does short-circuit by default and helped clear things up for me.-xor
could not possibly short circuit... right? It must evaluate both sides of the expression to determine the exclusivity... ... right?