What is the difference between Dim And Redim
Answer Posted / deepa
Dim Statement
Declares variables and allocates storage space.
Dim varname[([subscripts])][, varname[([subscripts])]] . . .
Variables declared with Dim at the script level are
available to all procedures within the script. At the
procedure level, variables are available only within the
procedure.
You can also use the Dim statement with empty parentheses
to declare a dynamic array. After declaring a dynamic
array, use the ReDim statement within a procedure to define
the number of dimensions and elements in the array. If you
try to redeclare a dimension for an array variable whose
size was explicitly specified in a Dim statement, an error
occurs.
ReDim Statement
Declares dynamic-array variables, and allocates or
reallocates storage space at procedure level.
ReDim [Preserve] varname(subscripts) [, varname
(subscripts)] . . .
The ReDim statement is used to size or resize a dynamic
array that has already been formally declared using a
Private, Public, or Dim statement with empty parentheses
(without dimension subscripts). You can use the ReDim
statement repeatedly to change the number of elements and
dimensions in an array.
If you use the Preserve keyword, you can resize only the
last array dimension, and you can't change the number of
dimensions at all. For example, if your array has only one
dimension, you can resize that dimension because it is the
last and only dimension. However, if your array has two or
more dimensions, you can change the size of only the last
dimension and still preserve the contents of the array.
The following example shows how you can increase the size
of the last dimension of a dynamic array without erasing
any existing data contained in the array.
ReDim X(10, 10, 10)
. . .
ReDim Preserve X(10, 10, 15)
Caution If you make an array smaller than it was
originally, data in the eliminated elements is lost.
| Is This Answer Correct ? | 20 Yes | 7 No |
Post New Answer View All Answers
wht is Manual Testing Frame work. Pls anybody can give appropriate answers
whow much strong on VB and C?
"What are the common constrains that we need to consider when we prepare testcases for ASP application". Thanks in Advance...
What are the check points can be inserted without recording?
what is stepin & stepout?
How can i initiate the objects to find uniquely in OR
Hi Friendss..., can any body help me.. 1. Tell me your achievements(Technically)..? 2. Tell me your strengths(Technically) and weakness(Technical)..? 3. Why are you looking for change..?
If I am scripting Web-based Surveys using QTP that open up differently but at the exact same point require a username and password can I automate that username and password for all the surveys some how using QTP?
Explain in brief about the quicktest professional (qtp) automation object model?
how to convert 100 into hundred repees only and viceversa
How to creating an output value using quicktest professional (qtp)?
what you mean by artifact,milestone...
How to use descriptive programming?
Do you know how to connect database? Can you tell me the procedures?
Hi. please provide license key for QTP 9.2, I have windows XP on my machine Thanks in Advance, moreshwar