array, array protect

Prev Next

Function Names

array, array protect

Description

array defines one or more arrays with all intial values provided directly. Already existing variable members will be eliminated. The function array project will also apply the protection settings on all member variables created. See description for function protect() for details. It may be useful to choose protection setting limited access in order to avoid accidental type changes on the array members.

Impact on base variables: The base variable values remain unaffected. These functions affect the members only.

Call as: procedure

Restrictions

Indirect parameter passing is disabled

Parameter count

array: 2, 4, 6, etc.; array protect: 3, 5, 7, etc.

Parameters

No.TypeDescription
1
input
string Protection setting

Applicable to array protect only. The supported protection settings are defined in the description for the function protect().

1, 3, ... or 2, 4, ...
code
variable
:string
Variable name

The array will be built on the specified variable. Member variables of existing arrays and structures are allowed so you can build more complex data structures.

2, 4, ... or 3, 5, ...
input
set Initial values

If a simple set is provided (no nested elements), then a one-dimensional array will be built. Nested paramter sets will create nested arrays.

Default value: text

Examples

       array( a[], { 1,2,3,{4,5},6 } );

       // Builds a[0] ... a[3] = { 1,2,3,6 }
       // Builds a[3,0] and a[3,2] with 4 and 5

       see ( a[] );

Output

a[]                     [Void]                     (void,full access)
Array [   0]            1  "1"                     (numeral,full access)
Array [   1]            2  "2"                     (numeral,full access)
Array [   2]            3  "3"                     (numeral,full access)
  Array [   0]          4  "4"                     (numeral,full access)
  Array [   1]          5  "5"                     (numeral,full access)
Array [   3]            6  "6"                     (numeral,full access)

Try it yourself: Open LIB_Function_array.b4p in B4P_Examples.zip. Decompress before use.

See also

dim
dim protect
structure
structure protect
insert members