dim protect, redim protect
These two functions work similarly like dim() and redim(), but will also apply protection settings on all member variables. It may be useful to choose protection setting limited access in order to avoid accidental type changes on the array members. No impact on protection settings on already existing array members with the redim protect function. Here only the new members will be applied with the new protection setting.
Indirect parameter passing is disabled
4, 7, 10, etc.
No. | Type | Description | ||||
---|---|---|---|---|---|---|
1 input |
string | Protection setting The supported protection settings are defined in the description for the function protect(). | ||||
2, 5, 8, ... 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. | ||||
3, 6, 9, ... input |
numeral set of numerals |
Dimension Following types are supported:
| ||||
4, 7, 10, ... input |
valid types | Initial value The initial value will be applied for every variable member. |
dim protect( limited access, a[], 5, 123 );
a[0] = 1;
a[1] = Hi; // Will issue an exception
echo("Test");
Row #: Code Text _______________________________________________________
1: dim protect( limited access, a[], 5, 123 );
2: a[0] = 1;
3:
4: a[1] = Hi; // Will issue an exception
^
Inside the started program code:
Assignment on variable with limited access and type numeral
with value of type string is not allowed
Failed to access variable, protections apply.
Code execution will stop. Going to interactive mode
________________________________________________________________________
Type 'help' for help, 'docs' for B4P docs, 'web docs' for online docs.
>>