Dynamic array in vbscript gets cleared when control comes out of loop
问题 I am newbie to VBScript. I am trying my hands at Dynamic array concept in VBScript below is my code. Code: dim arr() For i = 0 To 3 Redim arr(i+1,2) arr(i,0)=i arr(i,1)=i+1 MsgBox arr(i,0)&"-"&arr(i,1) Next For i = 0 To UBound(arr) MsgBox arr(i,0)&" "&arr(i,1) Next As soon as the control comes into second loop all the values stored in arr are lost. i do not understand why and how? I've tried adding Preserve keyword but it throws subscript out of range error. TIA!!! 回答1: [oops, missed the two