WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Arrays
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

ArrInitialize NULL Fails

 Keywords: ArrInitialize NULL EMPTY 

Question:

The following code fails:
null = ObjectType("NULL","")
aRR = ArrDimension(4)
ArrInitialize(aRR,null)
However, this works
For i=0 To 3
aRR[i] = null
Next
Please explain.

Answer:

Yes. The help file documentation plainly states that the initializer can be an 'integer, floating point, or string value.'

In fact, the function is intentionally coded to only accept ANSI and Unicode strings, floats, and integers as initializers. It simple does not permit the use of other WinBatch variable types, including variants, as initializers.

Arrays can be populated with almost any WIL variable type as array elements are really light weight, nameless WIL variables. However, assigning any particular value to a small group of elements does not have the same potential for untoward side-effects as performing an on mass initialization.

I do not know the exact thinking behind the function's implementation but I suspect that the function is coded they way it is to save the user from some of the less than desirable outcomes of using certain values for initialization and also to keep the implementation simple and maintainable.


Article ID:   W17659
Filename:   ArrInitialize NULL Fails.txt
File Created: 2009:12:14:15:05:32
Last Updated: 2009:12:14:15:05:32