identify

Prev Next

Function Names

identify

Description

Identifies the variable form (existence of structure or array). If the variable does not exist, then "not found" will be returned.

Call as: function

Restrictions

Indirect parameter passing is disabled

Parameter count

1

Parameters

No.TypeDescription
1
code
variable
:string
Variable to check

Return value

TypeDescription
string variable form

One of the following:

not found Variable does not exist
simple Simple variable (contains no members)
structure Variable contains named members
array Variable contains array members
zero members A variable which contained members but have been deleted or originates from a loaded JSON file with zero-element array read in.

Examples

       a[] = 1;
       b[a] = 2;
       dim(c[], 1, 3);

       echo( identify(a[]));     // Returns simple
       echo( identify(b[]));     // Returns structure
       echo( identify(b[a]));    // Returns simple
       echo( identify(c[]));     // Returns array
       echo( identify(d[]));     // Returns not found
       delete( b[a] );
       echo( identify(b[]));     // Returns zero members

Output

simple
structure
simple
array
not found
zero members
Try it yourself: Open LIB_Function_identify.b4p in B4P_Examples.zip. Decompress before use.

See also

scope