member count

Prev Next

Function Names

member count

Description

This function returns the number of members in arrays and structures. Nested members will not be counted.

Call as: function

Restrictions

Indirect parameter passing is disabled

Parameter count

1

Parameters

No.TypeDescription
1
code
variable
:string
Variable name

Return value

TypeDescription
numeral Member count

Examples

       dim( a[], 10, Hey );    // An array with 10 elements
       dim( a[3], 3, Hi );     // 3 sub-members in a[3]
       b[Name]= Jim;           // A structure with 2 members
       b[Age] = 38;

       c[] = 1;                // A simple variable, 0 members

       echo( member count( a[] ), ", ", member count( a[3]), ", ",
                 member count( b[] ), ", ", member count( c[] ) );

Output

10, 3, 2, 0
Try it yourself: Open LIB_Function_member_count.b4p in B4P_Examples.zip. Decompress before use.

See also

dim
array
structure