C Expandable#

The Switch C Expandable block is used to loop the blocks within a specific branch when the condition in the open space of the block is met. Additional branches can be added by expanding the block.

They are shaped to attach stack and other C blocks above, below, or inside them.

c_expandable_block

Select the open space of the block indicated in the image here and begin typing.

c_expandable_select

To expand the block to include additional branches, select the + icon.

c_expandable_plus

To remove a branch from the block, select the - icon. This will remove the lowest branch.

c_expandable_minus

Some possible Switch Python commands to use with the Switch C Expandable block include:

  • while

  • if

  • for

In order for a Switch C Expandable block to function as intended, the Switch Python commands must be entered with the correct spelling, punctuation, and indentation. Refer to the Help of each block to see the matching Switch Python command.

In this example, the code will continuously check if the Left Bumper Sensor is pressed. If the Left Bumper Sensor is not pressed, the VR Robot will drive forward, otherwise, it will stop.

c_expandable_example