Change Value

Set the value for local and global variables.

Change the value of a variable

let x = 0
x += 1

Declare a variable

Use the assignment operator to set the value of a variable. Change the value of a variable from 0 to 1 using the change item block. Like this:

let x = 0
x += 1

Example

Use the assignment operator to set the value of a variable. Change the value of a variable from 0 to 1 using the change item block. Then display the new value of the variable on the LED screen. Like this:

let x = 0;
x += 1;
basic.showNumber(x);

Notes

See also

variable, types

Edit this page on GitHub