null

suggest change

$null is used to represent absent or undefined value.

$null can be used as an empty placeholder for empty value in arrays:

PS C:\> $array = 1, "string", $null
PS C:\> $array.Count
3

When we use the same array as the source for ForEach-Object, it will process all three items (including $null):

PS C:\> $array | ForEach-Object {"Hello"}
Hello
Hello
Hello

Be careful! This means that ForEach-Object WILL process even $null all by itself:

PS C:\> $null | ForEach-Object {"Hello"} # THIS WILL DO ONE ITERATION !!!
Hello

Which is very unexpected result if you compare it to classic foreach loop:

PS C:\> foreach($i in $null) {"Hello"} # THIS WILL DO NO ITERATION
PS C:\>

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Automatic variables:
* OFS
*
* null
* error
* pid
* PSItem

Table Of Contents
1 Loops
19 XML
22 Strings
25 Aliases
26 Automatic variables
47 MongoDB
65 AWS S3