Cold Help System: Programming: ColdC Reference Manual: Language Structure: Expressions: Operators: Arithmetic Operators: Non-Numeric Use


The binary + operator can also be applied to strings, lists and buffers. Using it in this way will cause it to concatenate the two values. For instance, the expression ("foo" + "bar") would evaluate to "foobar", and the expression (["foo", "bar"] + ["baz"]) would result in the list ["foo", "bar", "baz"].

As long as both sides of the operator are the same data type (which is restricted to strings, lists and buffers) no error will be raised. If one side of the operator is a string (either side), and the other side is not a string, it will be converted to its literal representation and joined with the string. For example, the expression ("list: " + [1, 2, 3]) would evaluate to "list: [1, 2, 3]".

The binary * may be applied with a string on the left side and an integer on the right side. In this situation the left side string is duplicated by the number of times specified by the right side integer. Example: ("-" * 5) would result in "-----".

Dual Role Assignment operators also behave in the same way, as is applicable. For instance, the dual role arithmetic operator += would behave the same as the standard arithmetic operator + when evaluating the addition expression.


Increment | Non-Numeric Use


the Cold Dark