Variables#

To put a variable in the Monitor Console, drag and drop its Reporter block to the Monitor Icon on the right side of the screen.

how_to_monitor

Numeric variable#

The Numeric variable block is used to report the numeric value assigned to the variable. Variables are created with global scope by default.

variable_block

Use the Set numeric variable block to set or update the numeric value of a variable.

The Numeric Variable reporter block is used in blocks with circular spaces.

Variables are created using the Make a Variable button.

make_a_variable

In this example, the variable driveLength is set to 500 and used in the Drive for block. This makes the Drive for block move forward for 500 mm.

set_variable_example

Set numeric variable#

The Set numeric variable block is used to set a numeric variable to a given value. Variables are created with global scope by default.

set_variable_block

Choose which numeric variable to use. Numeric variables can also be renamed or deleted.

set_variable_select

The Set numeric variable block can accept decimals, integers, or numeric blocks.

In this example, the variable driveLength is set to 500 and used in the Drive for block. This makes the Drive for block move forward for 500 mm.

set_variable_example

Change numeric variable#

The Change numeric variable block is used to change a variable by the given value.

change_variable_block

Choose which numeric variable to use - the selected variable can also be renamed or deleted.

change_variable_select

The Change numeric variable block can accept decimals, integers, or numeric blocks.

In this example, the variable driveLength is changed by 500 and used in the Drive for block. This makes the Drive for block move forward for 500 mm.

change_variable_example

Boolean variable#

The Boolean variable block is used to report the value of a Boolean variable. Variables are created with global scope by default.

boolean_variable_block

Use the Set boolean variable block to set or update the value of a boolean variable.

The Boolean variable block reports a true or false value and is used in blocks with hexagonal (six-sided) spaces.

Boolean variables are created using the Make a Boolean button.

make_a_boolean

In this example, the driveNow Boolean variable is set to True at the start of the project. This makes the Drivetrain drive forward until the driveNow variable returns False.

boolean_variable_example

Set Boolean variable#

The Set Boolean variable block is used to set a boolean variable to a given value. Variables are created with global scope by default.

set_boolean_variable_block

Choose which boolean variable to use. Boolean variables can also be renamed or deleted.

set_boolean_variable_select

Choose a Boolean value.

set_boolean_variable_value

The Set Boolean variable block can accept hexagonal (six-sided) shaped blocks.

In this example, the driveNow Boolean variable is set to True at the start of the project. This makes the Drivetrain drive forward until the driveNow variable returns False.

boolean_variable_example

List item#

The List item block is used to report the value of an item in a list.

list_item_block

Choose which list to use. The list can also be renamed or deleted.

list_item_select

Enter the number of the item’s position within the list. Here, the second item in list (item 2) is being reported.

The List item block can accept decimals, integers, or numeric blocks.

In this example, the cardinalHeadings list stores the degrees for north, east, south, and west. The Drivetrain turns to face item 3, which is set to 180 degrees.

set_list_item_example

Replace List item#

The Replace List item block is used to update an item in the list to a new value.

replace_list_item_block

Choose which list to use. The list can also be renamed or deleted.

replace_list_item_select

The Replace List item block can accept decimals, integers, or numeric blocks.

In this example, only item 2 of the cardinalHeadings list is replaced with 90. The Drivetrain will then turn to a heading of 90 degrees.

replace_list_item_example

Set List item#

The Set List item block is used to set every item in the list to the entered values. Variables are created with global scope by default.

set_list_item_block

Choose which 2D list to use. The 2D list can also be renamed or deleted.

set_list_item_select

The Set List item block can accept decimals, integers, or numeric blocks.

In this example, the cardinalHeadings list stores the degrees for north, east, south, and west. The Drivetrain turns to face item 3, which is set to 180 degrees.

set_list_item_example

Length of List#

The Length of List block is used to report the number of items in a list.

length_list_block

Choose which list to use. The 2D list can also be renamed or deleted.

length_list_select

The Length of List reporter block fits in blocks that accept circular spaces.

In this example, the length of the cardinalHeadings list will be printed to the Console.

length_list_example

2D List item#

The 2D List item block is used to report the value of an item in a 2D list.

2d_list_item_block

Choose which 2D list to use. The 2D list can also be renamed or deleted.

2d_list_item_select

Enter the item’s row (first number) and column (second number) position within the list to be reported. Here, the item in position row 2, column 3 in the 2D list is being reported.

2d_list_item_list

The 2D List item block can accept decimals, integers, or numeric blocks.

In this example, the moveCoordinates 2D List is used to store numeric values that relate to positions on the playground. Assuming that the VR Robot starts at the coordinate (0, 0), the Drivetrain uses the items from (5,1) and (5,2) in the 2D List to move to the coordinate (300, 200).

set_2d_list_item_example

Replace 2D List item#

The Replace 2D List item block is used to update an item in the 2D list to a new value.

replace_2d_list_item_block

Choose which 2D list to use. The 2D list can also be renamed or deleted.

replace_2d_list_item_select

The Replace 2D List item block can accept decimals, integers, or numeric blocks.

In this example, the Drivetrain will drive forward for 2 seconds. It will record the VR Robot’s current Y coordinate in the second column of the first row in its moveCoordinates 2D list before stopping.

replace_2d_list_item_example

Set 2D List item#

The Set 2D List item block is used to set every item in the 2D list to the entered values. Variables are created with global scope by default.

set_2d_list_item_block

Choose which 2D list to use. The 2D list can also be renamed or deleted.

set_2d_list_item_select

The Set 2D List item block can accept decimals, integers, or numeric blocks.

In this example, the move_coordinates 2D List is used to store numeric values that relate to positions on the playground. Assuming that the VR Robot starts at the coordinate (0, 0), the Drivetrain uses the items from (1,1) and (1,2) in the 2D List to move to the coordinate (300, 150).

set_2d_list_item_example

Length of 2D List#

The Length of 2D List block is used to report the number of rows or columns in a 2D list.

length_2d_list_block

Choose which 2D list to use. The 2D list can also be renamed or deleted.

length_2d_list_select

Choose which value to report. The 2D list can report either rows or columns.

length_2d_list_value

The Length of 2D List reporter block fits in blocks that accept circular spaces.

In this example, the VR Robot will print how many rows there are in the moveCoordinates 2D List.

length_2d_list_example