Powershell folly

Home renovation kept me from doing much IT related things in my free time, but this is something I needed to share. If you do this in powershell:

$array = @(1,2,3,4,5,6,7,8,9,10)
$array[0..-1]

The result is really not what any programmer would expect. Rather than throw an exception, powershell simply decides to roll over to the end and say that the result is

1
10

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s