The Variable block allows you to save and manipulate data values in your projects.Variables can be assigned a 4-character name and a value in the range -999 to 999.
Variables can be used in two ways:
Variable blocks can be used as stand-alone blocks where they can be assigned values, or incremented or decremented.
Once the block is dropped onto the canvas, you can use the Add button to assign a name for this variable.
If a variable already exists, you can select it for it to be used in and as this block.
You can set a 4 character name for the variable created in the previous step.
After you've set a name for this block, you can select the operator to be used with it.
Here, you can assign a value to it, or increment/decrement it by 1.
If the assignment operator is used, you can assign to this variable , either a custom numeric value, or another existing variable (if present)
Custom
Variable
If an existing variable is present, you can assign it to the current variable.
A Variable block can also be used to check a condition inside the head of an If or While block as shown.
You can create a new variable using the Add button, or use an existing variable
If a new variable is added, it appears as below.
For this newly added block, you can select a comparison operator
This block's value can be compared againsy a custom integer value or another existing variable.
An instance of a variable can be deleted from the canvas by using the Delete option in the Edit toolbar. This deletes only the current occurrence of the variable.
You can press the (X) icon on the project toolbar to view the details of variables used in the project.
The superscript indicates the number of variables in the project.
A variable can be deleted from the project by deleting it in the Variable Declaration section.
This deletes every instance of the variable through the project.
If this variable, say var1, was assigned to another variable var2, it is deleted from this instance , leaving the parent variable var1 assigned a blank value as shown.
A variable can only be renamed in the Variable Declaration section.
The total number of variables in the project can be viewed at the top of the canvas.
Clicking the X icon displays the Variable Declaration section.
You can use this section to rename or delete a variable throughout the project.