AI2 Variables

Variable Blocks

There are five main types of variable blocks:

initialize global name to

This block is used to create global variables. It takes in any type of value as an argument. Clicking on name will change the name of this global variable. Global variables are used in all procedures or events so this block will stand alone.

Global variables can be changed while an app is running and can be referred to and changed from any part of the app even within procedures and event handlers. You can rename this block at any time and any associated blocks referring to the old name will be updated automatically.

get

This block provides a way to get any variables you may have created.

set to

This block follows the same rules as get. Only variables in scope will be available in the dropdown. Once a variable v is selected, the user can attach a new block and give v a new value.

initialize Local name to in

This block is a mutator that allows you to create new variables that are only used in the procedure you run in the bottom part of the block. This way all variables in this procedure will all start with the same value each time the procedure is run.

You can rename the variables in this block at any time and any corresponding blocks referring to the old name will be updated automatically

initialize Local name to in

This block is a mutator that allows you to create new variables that are only used in the procedure you run in the bottom part of the block. This way all variables in this procedure will all start with the same value each time the procedure is run.

You can rename the variables in this block at any time and any corresponding blocks referring to the old name will be updated automatically

For more help on the topic of global and local variables, take a look at the Global vs Local Variables page.