Cold Help System: Programming: ColdC Reference Manual: Language Structure: Expressions: Operators: Assignments: Default


The default assignment is used to assign a value to a variable if the current value of the variable is logically false. The default assignment operator is:

?=

And the syntax is:

variable ?= value expression

When executed the driver tests the logical value of variable. If it is false, it assigns the result of value expression, otherwise it is untouched. Example:

len ?= 79;

Will assign 79 to len if it is false (for instance, if it is zero). This operator is equivalent to a combination of the Simple Assignment and the if-else Conditional Expression:

len = len ? len : 79;


Simple | Scatter | Dual | Default


the Cold Dark