Adds the specified number to the value currently assigned to a variable.
The value of the variable is set to the sum of its current value and the specified number. If the variable does not currently have a numerical value, the specified value will be assigned to the variable directly.
Examples
Example 1
Read and run this code to see how changing a variable works.
Example 2
These chicks spread quickly! Each time a chick is clicked, it increases the number of new chicks made by 2.
Syntax
math_change
Parameters
Name | Type | Required? | Description |
---|---|---|---|
number | The amount to add to the value of the variable | ||
variable name | The name of the variable whose value is being changed |
Found a bug in the documentation? Let us know at support@code.org.