Is dynamic array initialized?

How to determine whether the dynamic array is initialized or not in LS.

Subject: Try the IsArray() function…

Tests the value of an expression to determine whether it is an array.Syntax

IsArray ( expr )

Elements

expr

Any expression.

Return value

IsArray returns TRUE (-1) if expr is an array; otherwise IsArray returns FALSE (0).

Subject: RE: Try the IsArray() function…

HUH?

Have you ever tried using this function for such purposes. If you would, you’d see that it alway returns true if you use it on an array(initialized or not).

I solved this problem by catching the 200 error.

Thanks for the tip Joris.

Subject: Is dynamic array initialized?

no LS function fot this AFAIK, but you can write your own function like this :

Function isinitialized(a) As Boolean

Dim u As Integer

On Error Goto skip

isinitialized=True

u=Ubound(a)    ' if a is not initialized, this produces an error

Exit Function

skip:

isinitialized=False

Resume Next

End Function