ReDim
Definition: Declares dynamic-array variables, and allocates
or reallocates storage space at procedure level.
In general there’s no need for a ReDimstatement in Windows PowerShell; arrays can be resized without having to explicitly call ReDim(and without having to explicitly preserve the existing contents of the array). For example, suppose the following 5 items are assigned to the array $a:
$a = 1 ,2,3,4,5
Want to add a new value – 100 – to the array? This is all you have to do:
$a = $a + 100
If you echo back the value of $ a you’ll get the following:
1
Likewise you can
truncate an array without explicitly
redimensioninganything. Suppose you
want only the first three values in $a. This code assigns just
those first three values (using the syntax
0..2, which means start with item 0 in the array, end with
item 2, and take all the values in between) and assigns them to
$a:
$a = $
a[0..2]
What do you get back
when you execute this command? This is what you get back:
1
The server encountered an internal error or
misconfiguration and was unable to complete
your request. Please contact the server administrator at
webmaster@systemmanager.forsenergy.ru to inform them of the time this error occurred,
and the actions you performed just before this error. More information about this error may be available
in the server error log. Additionally, a 500 Internal Server Error
error was encountered while trying to use an ErrorDocument to handle the request.
2
3
4
5
100
2
3
Internal Server Error