You can use the change operator with variables of each of the supported types.
Change value
Change, meaning increase, the value of a variable by some amount.
let x = 0
x += 2
The change blocks increase the value in the variable by the amount you want. This is also known as an addition assignment operation.
Change a declared variable
Use the change operator to set a new, larger value to a variable.
If you let
a variable have a value of 1
, the change block makes the value change
by 2
like this:
let x = 1
x += 2