set, set names
The function set lists all member values of the array or structure in a parameter set.
The function set names lists all member names of the structure in a parameter set. For obvious reasons, this function will not work with arrays.
Hint: Use the function flat() to remove any nesting in generated parameter 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 |
---|---|
parameter 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[] = set( Hi[ ] ); n[] = set names( Hi[ ] );
echo("Names: ", n[]);
echo("Values: ", v[]);
// Include 'invalid value' in Hi[Spanish].
v[] = set( Hi[ ], 0, all ); n[] = set names( Hi[ ], 0, all );
echo("Names: ", n[]);
echo("Values: ", v[]);
// Only 2nd level (like in Bavria ...)
v[] = set( Hi[ ], 2 ); n[] = set 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'}}