Chapter 3. Comparison Operators
PowerShell comparison operators are used to validate data present within your scripts. These operators enable you to compare data and execute code based on the data. This makes PowerShell an extremely effective tool to use for processing complicated data with the available comparison operators.
In this chapter, you will learn the following concepts:
- Comparison operator basics
- Equal and not equal comparison operators
- Greater than and less than comparison operators
- Contains, like, and match comparison operators
- -AND / -OR comparison operators
- Best practices for comparison operators
Comparison operator basics
When you are using comparison operators, you are creating expressions that evaluate to either True
or False
. In programming, this is known as Boolean. In the simplest form, you are asking PowerShell to evaluate similarities or dissimilarities between two items. Based on the findings from that expression, it will return True
or False
. When the whole expression...