variable members, variable names
The function variable members lists all member values of the array or structure in a set.
The function variable names lists all member names of the structure in a set. For obvious reasons, this function will not work with arrays.
Hint: Use the function flat() to remove any nesting in generated sets.
Indirect parameter passing is disabled
1-3
No. | Type | Description |
---|---|---|
1 code |
variable :string |
Variable name |
2 input |
numeral | Level 0: All valid contents (except voids) of members and sub-members will be returned. Sub-members will be packaged in nested paramter sets. |
3 input |
string | Option Only supported value: all. |
Type | Description |
---|---|
set | Extracted values or names |
Hi[ German ] = Hallo; Hi[ German, in Switzerland ] = Grüezi;
Hi[ German, in Bavaria ] = Grüss Gott;
Hi[ French ] = Allô; Hi [ English ] = Hello;
Hi[ Spanish, on the Phone ] = Diga;
v[] = variable members( Hi[ ] );
n[] = variable names( Hi[ ] );
echo("Names : ", n[]);
echo("Values: ", v[]);
echo;
// Include 'invalid value' in Hi[Spanish].
v[] = variable members( Hi[ ], 0, all );
n[] = variable names( Hi[ ], 0, all );
echo("Names : ", n[]);
echo("Values: ", v[]);
echo;
// Only 2nd level (like in Bavria ...)
v[] = variable members( Hi[ ], 2 );
n[] = variable names( Hi[ ], 2 );
echo("Names : ", n[]);
echo("Values: ", v[]);
Names : {'English','French','German',{'in Bavaria','in Switzerland'},{'on the Phone'}}
Values: {'Hello','Allô','Hallo',{'Grüss Gott','Grüezi'},{'Diga'}}
Names : {'English','French','German',{'in Bavaria','in Switzerland'},'Spanish',{'on the Phone'}}
Values: {'Hello','Allô','Hallo',{'Grüss Gott','Grüezi'},# Invalid Value #,{'Diga'}}
Names : {{'in Bavaria','in Switzerland'},{'on the Phone'}}
Values: {{'Grüss Gott','Grüezi'},{'Diga'}}