3

I want to define an array which will contain 100 empty cells . So far I did it in this way :

$EntryAmount = New-Object 'double[]' 100

It seems to be working, but I'm not sure it's the right way. From all of the examples that I've seen, there was a definition for empty arrays without actual size or with specific content which then defined the size.

Marked One
  • 294
  • 2
  • 3
  • 13

2 Answers2

1

To create the array:-

[double[]] $EntryAmount = @($null)*100

To populate the array:-

$EntryAmount[0] = 50.35
Vivek Kumar Singh
  • 3,223
  • 1
  • 14
  • 27
D. Mac
  • 26
  • 5
0

One way is -

$EntryAmount = @(0) * 100

OR

$EntryAmount =,0 * 100

See this link for more such ways of defining an array.

Vivek Kumar Singh
  • 3,223
  • 1
  • 14
  • 27