View Single Post
Old 04-10-2008   #1 (permalink)
Roman Kuzmin
Guest


 

Confusing prompt for a [bool] value (V2 CTP)

Run this (script cmdlet with a mandatory [bool] parameter), input various
values and watch the results (Ctrl-C to stop). Everything except an empty
string is converted into True.

# begin test
cmdlet Test-Me
{
param ( [Mandatory][bool]$Bool )
$CommandLineParameters
}
for(; { Test-Me }
# end test

Output (filtered):
Bool: 1
Bool True
Bool: 0
Bool True
Bool: True
Bool True
Bool: False
Bool True
Bool: $True
Bool True
Bool: $False
Bool True
Bool:
Bool False

The question:
Is this by design, a bug or am I missing something?

--
Thanks,
Roman Kuzmin

http://code.google.com/p/farnet/
PowerShell and .NET in FAR Manager


My System SpecsSystem Spec