Disabling and Enabling Blocks in VEXcode EXP

VEXcode Blocks allows users to disable and enable blocks within their projects. This is a useful feature for testing or debugging a project without having to take the project apart. The user can disable or enable a block(s) to test the differences in the robot’s behavior when that block is or is not in the project.


How to disable and enable blocks

VEXcode EXP Blocks project with an enabled block's context menu opened and the Disable Block option highlighted. To the right the result is shown with the selected block now grayed out to indicate that it has been disabled.

To disable a block, right-click or long-press on the block to activate the Context Menu and then select Disable Block.

VEXcode EXP Blocks project with a disabled block's context menu opened and the Enable Block option highlighted. To the right is the same project but with the selected block now in color to indicate that it has been enabled.

To enable a disabled block, activate the Context Menu for that block and select Enable Block.


What happens to individual blocks when disabled

VEXcode EXP Blocks project containing a disabled block. The block is grayed out and has a grid of diagonal lines over it.

While a block(s) is disabled, it is shown grayed out with a grid of diagonal lines over it.

The disabled block is treated like a comment. It has no effect on the flow of the project.

In the example project above, the robot will not wait after driving in reverse, but will immediately turn right.


What happens when a block with nested blocks is disabled

When you disable a block with blocks nested within it, all of the blocks are disabled. Blocks like a loop or if-then-else conditional, that have nested blocks, can be disabled in the same way a single block can. 

VEXcode EXP Blocks project with an enabled container block's context menu opened and the Disable Block option highlighted.

Activate the Context Menu of that loop or conditional Control block, and then select Disable Block.

VEXcode EXP Blocks project with a container block and all of its nested blocks disabled. The blocks are grayed out and have a grid of diagonal lines over them.

The image below shows what happened when the repeat loop was disabled. The loop and the two blocks inside of it were all disabled.

VEXcode EXP Blocks project with a disabled container block's context menu opened and the Enable Block option highlighted.

You can enable the main block and all nested blocks within it by activating the Context Menu of the main block and selecting Enable Block.

VEXcode EXP Blocks project with a container block and all of its nested blocks enabled.

When the main block is enabled, all nested blocks will also be enabled.


Disabling and enabling a single nested block

You can disable single blocks within a loop or if-then-else by following the same steps for disabling any other block: activate that block’s Context Menu and choose Disable Block.

VEXcode EXP Blocks project with a nested block already disabled.

Here is an example of only disabling a single block within a loop.

VEXcode EXP Blocks project with a container block's context menu opened and the Enable block option highlighted but grayed out. One of its nested blocks is disabled, but the Enable block option isn't available since the container block itself is still enabled.

The Context Menu for the main block will not provide an option for enabling the nested block because the main block was not disabled.

VEXcode EXP Blocks project with a disabled block's context menu opened. The block is nested inside of a container block, and the Enable Block option is highlighted. To the right the result is shown with the selected block now enabled.

If later you want to enable that nested block, you will need to activate its Context Menu.


Disabling a “hat” block

You can disable an entire stack of blocks by disabling the “hat” block that contains them all. 

VEXcode EXP Blocks project with an enabled hat block's context menu opened. The Disable Block option is highlighted.

Activate the Context Menu of the “hat” block, and then select Disable Block.

VEXcode EXP Blocks project with a hat block disabled, and the rest of the blocks in the stack still enabled. The hat block is grayed out and has a grid of diagonal lines over it.

The image below shows what happened when the When Started “hat” block is disabled. All of the blocks contained under the When Started block will not run.

For more information, help, and tips, check out the many resources at VEX Professional Development Plus

Last Updated: