On Wed, 20 Dec 2006 17:58:01 -0800, John Smith
<JohnSmith@discussions.microsoft.com> wrote:
> I am retrieveing command line arguments passed to a PS1 script. I find that:
>
> a. ./myscript 5 $args[0].GetType() gives Int32
> b. ./myscript -5 $args[0].GetType() gives String
> c. ./myscript (-5) $args[0].GetType() gives Int32
>
> Is this how it is supposed to work?
Interesting, I didn't know that.
It's the same with functions, but I suppose most people would use the
parentheses there out of habit and never notice it:
function testit($arg){ $arg.GetType() }
testit 5
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True Int32 System.ValueType
testit -5
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True String System.Object
testit (-5)
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True Int32 System.ValueType