Variable Block
This is the variable block. It acts as the variable selected from inside it. Before we go any further let's make sure we understand what a variable is.
A variable is a storage place for information. Information can be an integer, a boolean, or text. An integer is any whole number, no decimal places. A boolean is a true or false, like a yes or no question. Text is a sentence or any arrangement of letters. A variable can only be one of these types and save only one of these values. For example, if I have an integer variable, I cannot put true in there or store 5 and 12 at the same time.
Variables are also typically named. So an integer variable might be named Highscore or Age and store a number that represents either a highscore or an age.
A variable is a storage place for information. Information can be an integer, a boolean, or text. An integer is any whole number, no decimal places. A boolean is a true or false, like a yes or no question. Text is a sentence or any arrangement of letters. A variable can only be one of these types and save only one of these values. For example, if I have an integer variable, I cannot put true in there or store 5 and 12 at the same time.
Variables are also typically named. So an integer variable might be named Highscore or Age and store a number that represents either a highscore or an age.
Variable blocks are the blocks that let you access a variable. So the first step to using one would be to make a variable. To make a variable go to Edit>Define Variables and the variable window will open up.
From this window we can see all the variable that have been created, though not necessarily used, in this program. Every program begins with three default variables: Logic 1, Number 1, and Text 1 which start with nothing in them. These variables aren't the best to use because the names aren't descriptive of what they store besides the type of data. So to create your own variables, click the create button.
When you do a new variable will show above and be selected by default. Click on it and you can alter the name and data type in the text boxes below the create button. A variable can be changed at any time though I do not advise this as it could mess up your program if you've already used it. When done, click the close button.
Now we have our variable. The next step is to use it in a variable block. When you grab a block and look inside of it there will be a list of all the variables in your program, including the one we just made. Select the new variable.
Once on the variable you want, there are one of two things you can do. In the Action section you can read the data, which allows you to pass the value inside that variable to other blocks through data hubs, or we can write data, which allows us to set what value is saved inside of the variable. Writing can be done by typing in a value below the Action section or using data hubs.
Back to Advanced Blocks