4Test supports the following assignment operators, where an arithmetic operator is combined with the "equals" sign:
+= | ^= |
-= | &= |
*= | |= |
/= | <<= |
%= | >>= |
**= | ~= |
This Shorthand Syntax... | Is Equivalent to This Syntax... |
---|---|
referent operator = expr | referent = referent operator expr |
i += 5 | i = i + 5 |
xyz %= 10 | xyz = xyz % 10 |
LongName *= 2 | LongName = LongName * 2 |
The referent is any data object that resolves to a specific location in memory where data is stored, such as an identifier, an index for a list element, or a record field.
This shorthand is useful whenever you need to increment or decrement an object. If a referent's name is long, you may find it easier to read and type than the conventional assignment syntax.