Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help on arrays
#1
Solved: 11 Years, 4 Months ago
Code:
Dim work(2)
work(0) = "Mon"
work(1) = "Tue"
work(2) = "Wed"
Erase work
ReDim work(5)
work(3) = "Fri"
PRINT work(4)

i have executed the above script and it is throwing error..i'm not sure why it is giving error..Can anyone correct the script

Thank you
Reply
#2
Solved: 11 Years, 4 Months ago
You should Redim at the time of array declaration as well
Code:
[b]ReDim[/b] work(2)
work(0) = "Mon"
work(1) = "Tue"
work(2) = "Wed"
Erase work
ReDim work(5)
work(3) = "Fri"
PRINT work(4)
Reply
#3
Solved: 11 Years, 4 Months ago
Thanks for ur reply

but i'm declaring it as a static array and however would like to change the size of the array(dynamically)

Is it possible to change the static array into dynamic array

for ex:

Dim customer(30)
ReDim customer(50)

Is this correct?
Reply
#4
Solved: 11 Years, 4 Months ago
no not possible
but you could declare array in different way

Code:
work=array("mon","tue","wed")

redim preserve  work(5)

work(3)="thu"
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to convert three arrays into just ONE array? Arena 2 4,900 04-10-2012, 09:35 AM
Last Post: Arena
  Editing java arrays in QTP davey2582 2 4,402 12-21-2011, 07:24 PM
Last Post: davey2582
  Runtime java object arrays EclipseDev 0 2,052 07-02-2008, 07:15 PM
Last Post: EclipseDev

Forum Jump:


Users browsing this thread: 1 Guest(s)