The VARIABLES blocks allow you to create and use variables in your programs.
set variable
The set variable block allows you to create a variable and assigns it an initial value. You can create multiple variables in your program.
- Click the item drop-down and choose new variable, then type in a unique name for your variable.
- Attach an initial value with either a number value block or a text string value block.
Once you create a variable, using this block again within your program will allow you to change the value of any variable you have created. The program will then use the new value for the rest of the program or until the value is changed again (see top image for example).
- Place the block at the desired location in your program.
- Select the correct variable name from the drop-down menu.
- Attach a number value block or a text string value block with a different value.
Your variable will also be accessible from any other block that has an item drop-down menu, such as the use variable block below.
use variable
The use variable block provides the value of the variable selected in the drop-down menu when inserted into other blocks.