Zero Members Variables

Prev Next

Zero Members

Zero members avariables are very closely related to simple variables. The only difference is that these variables have contained array or structure members before, but all members have been deleted meanwhile. In some application cases, e.g. loading variables from JSON files, zero members may be useful to distinguish between loading empty arrys and no arrays at all.

       
       echo("Distinguish between simple and zero members variables");
       a[] = Hi;
       echo(identify(a[0])); // simple

       a[0] = Ho;
       echo(identify(a[0])); // array

       delete(a[0]);
       echo(identify(a[0])); // not found
       echo(identify(a[])); // zero members

       a[dog] = Hund;
       echo(identify(a[])); // structure

Distinguish between simple and zero members variables
not found
simple
not found
zero members
structure
Try it yourself: Open LAN_Features_zero_members.b4p in B4P_Examples.zip. Decompress before use.