C Block#

The Switch C Block block is used to loop the blocks within until the condition in the open space of the block is met.

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

c_block_block

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

c_block_select

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

  • while

  • if

  • for

In order for a Switch C 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, when the Left Bumper is pressed, the robot will print “The bumper was pressed!” to the console.

c_block_example