Curious, what is the idea behind this:
@() -as [bool] # False @($null) -as [bool] # False @($null, $null) -as [bool] # True
I would expect either False/True/True or False/False/False, but not False/False/True.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As outlined in the Powershell Quick reference¹:
I think the idea behind it was that an array with just one element
$falsecan easily happen if you put the output of a cmdlet/function into an array. You might expect more values but some error made it to return$false, but$falsetwice in the array might be unlikely in that case.Or maybe we should wait for Jeffrey Snover to answer here 🙂
¹ C:\Windows\System32\WindowsPowerShell\v1.0\Documents\en-US\QuadFold.rtf on my machine