Appendices
Conditional Operators

Conditional Operators

Comparison Operators

OperatorCase-InsensitiveCase-SensitiveDescriptionExample
-eq-eq-ceqEqual to$a -eq $b
-ne-ne-cneNot equal to$a -ne $b
-gt-gt-cgtGreater than$a -gt $b
-ge-ge-cgeGreater than or equal to$a -ge $b
-lt-lt-cltLess than$a -lt $b
-le-le-cleLess than or equal to$a -le $b
-like-like-clikeWildcard string match (*, ?)"hello" -like "hel*"
-notlike-notlike-cnotlikeWildcard string does not match"hello" -notlike "bye*"
-match-match-cmatchRegex match"hello" -match "^hel"
-notmatch-notmatch-cnotmatchRegex does not match"hello" -notmatch "^bye"
-contains-contains-ccontainsCollection contains value@(1,2,3) -contains 2
-notcontains-notcontains-cnotcontainsCollection does not contain value@(1,2,3) -notcontains 5
-in-in-cinValue is in collection2 -in @(1,2,3)
-notin-notin-cnotinValue is not in collection5 -notin @(1,2,3)

Logical Operators

OperatorDescriptionExample
-andBoth conditions must be true$a -gt 0 -and $b -gt 0
-orAt least one condition must be true$a -gt 0 -or $b -gt 0
-notNegates a condition-not $a
!Negates a condition (alias for -not)!$a
-xorExactly one condition must be true$a -xor $b

Type Operators

OperatorDescriptionExample
-isObject is of specified type$a -is [int]
-isnotObject is not of specified type$a -isnot [string]
-asConverts object to specified type$a -as [int]

Bitwise Operators

OperatorDescriptionExample
-bandBitwise AND0b1100 -band 0b1010 → 8
-borBitwise OR0b1100 -bor 0b1010 → 14
-bxorBitwise XOR0b1100 -bxor 0b1010 → 6
-bnotBitwise NOT-bnot 0b1111
-shlShift bits left1 -shl 3 → 8
-shrShift bits right8 -shr 3 → 1

Note: String comparisons using operators without a c prefix (e.g., -eq, -like, -match) are case-insensitive by default. Prefix with i (e.g., -ieq) to make the case-insensitivity explicit.