Powershell comparison: $null on the left

When I write powershell scripts, I always use below method to check whether variable is null or not.

When I use VScode, VScode suggested me to put $null to left. Why?

Check below example:

So, the right way to compare is always put $null on the left side.

Leave a Reply

Your email address will not be published. Required fields are marked *