This article introduces a very special variable in PowerShell, that is $null. What's special about $null is that it never stores content.
When I was looking through a PowerShell book, I found a description of the $null variable. The editor found it very interesting and I will share it with you in a close-up.
Take a look at this example:
Copy the codeThe code is as follows:
PS C:\Users\zhanghong> $null=1122
PS C:\Users\zhanghong> $null
PS C:\Users\zhanghong>
Do you understand? The editor assigned a value of "1122" to the $null variable, but when I output it, I found that it had no content.
If we use $null and here string (that is @"), we can make multiple lines annotations. Let's look at the effect:
Copy the codeThe code is as follows:
#Normal Comments
$null=@"
Comment content line 1
Comment content line 2
Comment content line 3
@"
#Normal Comments
You can experience the wonderful uses of the $null variable on your own.
Okay, Brother Hong will introduce this regarding PowerShell special variable $null, I hope it will be helpful to everyone.