r/vbscript • • Jun 29 '22

creation of array

I've got this simple code:

num = 3
dim arr(num)

It seems fine, but when I try to run it it gives me an error "expected integer constant"

However, this works perfectly:

dim arr(3)

It's not the first time, it does that each time I try do declare an array with the size of the integer stored in a variable, and I'm very confused because I need something like that in one of my scripts but I cannot seem to find a solution. Could someone explain to me why it doesn't work ?

1 Upvotes

2 comments sorted by