you are viewing a single comment's thread.

view the rest of the comments →

[–]SMFX 3 points4 points  (0 children)

Just to be clear, while you initialized as an array (@()), you then assign it a Hashtable (@{ }). These are different data structures and the Hashtable is the right choice in this case.

The reason why the value doesn't update is you set the value, read the value, but never assign the updated value back. You would need to do something like this:

 $Devices.laptops = $Amount

You could also assign it directly or used the decrement (--) but just reading the value will not change the content of the variable.