![]() |
The Variable block lets you read or write a Variable in your program. You can also create a new Variable and name it. A Variable is a location in the memory of the EV3 Brick that can store a data value. You can write to a Variable to store a data value. Later in the program, you can read from the Variable to access the stored value. |

| 1. | Insert or select a Variable block. |
| 2. | Use the Mode Selector to choose Write mode. |
| 3. | Choose the variable type (Numeric, Logic, Text, Numeric Array, or Logic Array). |
| 4. | Click the Block Text Field on the top of the block and select “Add Variable”. The New Variable dialog box will appear, as shown below. |

| 5. | In the New Variable dialog box, enter a name for your variable and click OK. A variable name can be a single letter, a word, several words, or any sequence of letters and numbers. |
| • | Choosing a short variable name will make it easier to see the whole variable name when you use it in your program. |
| • | Choose a name that will help you remember what the variable means, and how it is different from other variables in your program. |
| • | Once you add a variable, it will be available for use in any of the programs in your project. |
| 6. | After you have added the variable, you can use the Variable block in Write mode to enter an initial Value for the variable. |
| 1. | Use the Mode Selector to choose the Write mode. |
| 2. | Choose the Type of the variable. |
| 3. | Click the block text field to display the popup menu. |
| 4. | Select Name of the variable that you want to use. |
| 5. | You can now store a value into the variable using the Value input. You can either enter the value directly in the Value input, or you can use a Data Wire. |
| 3. | You can now get the value of the variable from the Value output, and use this in your program with a Data Wire. |

