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.

0

2 Answers 2

1

To create the array:-

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

To populate the array:-

$EntryAmount[0] = 50.35
Sign up to request clarification or add additional context in comments.

Comments

0

One way is -

$EntryAmount = @(0) * 100

OR

$EntryAmount =,0 * 100

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.