Windows Powershell for processing a Boolean value

Windows PowerShell has a lot of scenes need to enter the parameters as a command of 0 or 1. Powershell for logic processing Boolean value of what is it? In addition to the most common of $ True, $ False, 1, 0. Enter the command parameters required for a Boolean value, if the input string some other what will happen? This would involve the processing mechanism within PowerShell.
First give a simple test function, can let the system determine the input variables will be determined to be TRUE or FALSE.

the Test function (of VALUE $) {
IF ($ of VALUE) {
the Write-Host -ForegroundColor GREEN "TRUE"
} {the else
the Write-Host -ForegroundColor RED "FALSE"
}
}
Let's test the number 0. If, as a digital input, the result is returned FALSE, then if the input as a string, then any string will be determined to TRUE.
Windows Powershell for processing a Boolean value

For variables, it will be determined using the value TRUE or FALSE variable. If the variable is not defined, then it is determined to FALSE.
Windows Powershell for processing a Boolean value
So even if no variable defined over it? What will return?
Windows Powershell for processing a Boolean value
The answer is FALSE.

Hopefully this article can help you understand the principles PowerShell Boolean value processing.

Guess you like

Origin blog.51cto.com/qiyuwei/2426025