mixed :set ( mixed &ARG , … )
mixed := ( mixed &ARG , … )
Takes any number of arguments. Performs an assigment between the rightmost pair of elements, then the second-rightmost, et cetera. Assigns the value of the right element to the left one. Note that references must be used for variable assignments to have effect.
Returns a copy of the value the leftmost argument ended up with.
The table below contains rules for assigning values. Note that these rules are non-symmetrical; swapping the values may yield a different result. The row contains the type of the first (left) value in pair, while the column contains the type of the second (right) value in pair.
NIL | bool | bin | oct | int | hex | float | string | array | dict | |
---|---|---|---|---|---|---|---|---|---|---|
NIL | Assignments to NIL values have no effect. | |||||||||
bool | Sets the bool to FALSE. | No type juggling needed. | Bool is turned to TRUE if number is non-zero. | If absolute value of number is greater-or-equal to 1.0, bool becomes TRUE. | If string is true or contains a non-zero number, bool becomes TRUE. | Bool is set to TRUE if structure is non-empty. | ||||
bin | Sets the number to 0. | Number becomes 1 if bool is TRUE and 0 if it's FALSE. | No type juggling needed. | Float is truncated. | String is converted to number (with regard to base). | Sets the number to amount of entries in structure. | ||||
oct | ||||||||||
int | ||||||||||
hex | ||||||||||
float | Float becomes 0.0. | Number becomes 1 if bool is TRUE and 0 if it's FALSE. | Integer part is equal to number, and fraction part is 0. | No type juggling needed. | String is converted to float. | Float is set to number of entries in structure. | ||||
string | Empty string. | TRUE or FALSE . | Text representation of number is put into string. No base-describing prefixes are attached. | Text representation of float is put into string. | No type juggling needed. | array({X}) , where {X} is the element count. | dict({X}) , where {X} is the element count. |
|||
array | For each element in structure, appropriate assignment is performed. | For elements unset in left structure, their value is copied from the right structure. For elements present in both structures, per-element assignments are performed. | ||||||||
dict |
# :set example. :set &NUM i20 :writeln $NUM :set &NUM s'1220' :writeln $NUM
wikipage modified on 2014/0601/2317