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.
Select the open space of the block indicated in the image here and begin typing.
To expand the block to include additional branches, select the + icon.
To remove a branch from the block, select the - icon. This will remove the lowest branch.
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 robot will drive forward, otherwise, it will stop.