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++:

  1. :=(int, a=10, b=13)
  2. :=(string, str="hello")
  3. +=(a, b)
  4. console(a)
  5. +=(str, ", ", "world!")
  6. console(str)

n++ example

Example of += being used with n++:

  1. @:=(int, a=10, b=13)
  2. @:=(string, str="hello")
  3. @+=(a, b)
  4. @console(a)
  5. @+=(str, ", ", "world!")
  6. @console(str)