fn: +=
[contents]

Contents

Syntax

The syntax for += calls is:

f++:  
+=(params)

n++:  
@+=(params)

Description

+= is the arithmetic assignment operator for addition, it takes at least two input parameters with the first specifying a variable name, if all remaining parameters are numbers it adds their sum to the variable specified by the first parameter, otherwise it adds their string concatenation.

Note: It is typically faster to use exprtk for arithmetic assignment operators, plus the syntax is nicer.

f++ example

Example of += being used with f++:

:=(int, a=10, b=13)
:=(string, str="hello")
+=(a, b)
console(a)
+=(str, ", ", "world!")
console(str)

n++ example

Example of += being used with n++:

@:=(int, a=10, b=13)
@:=(string, str="hello")
@+=(a, b)
@console(a)
@+=(str, ", ", "world!")
@console(str)

Sponsors