Assignments into Sets

Prev Next

Overview

If the destination variable is a set, then assignments can be applied on specific elements, or one element can be appended. If the set is (still) empty, then element 0 can be assigned (a[]{0} = ... ) to append the first element. Going beyond results in errors

Examples
       a[] = { 0,1,2,3,4,5 };
       a[]{1} = 11; // Replace an element
       a[]{6} = 6; // Append an element
       echo(a[]);
{0,11,2,3,4,5,6}
Try it yourself: Open LAN_Features_Assignments_into_sets.b4p in B4P_Examples.zip. Decompress before use.

See also

Sets