Categories

Scripting Games–integer parameters

I keep seeing paramter constructs like this:

[int]$age = '90'

Why set the parameter to an integer and then set the default as a string.  PowerShell will convert but it just doesn’t make sense.

All you need is

[int]$age = 90

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>