The CONTROL blocks in BlocklyProp are used to build the structure of a blockly program. Use these blocks to add a loop, if…do statement, wait time, or program comment.
The loop forever block creates a loop that, depending on the option chosen in the menu, can do one of four functions – repeat forever, __ x times, until __, or while __. With the exception of repeat forever, each of the other options requires a condition to be added that indicates when the loop should end.
The loop item block creates a loop that repeats a certain number of times, starting with the from__ value and ending with the end__ value. To take larger steps between the start and end values, increase the by__ value.
Caution: If you are using a variable you already created for the loop item, this block will reset it to be equal to the from__ value, and it will keep changing the value of the variable each time it loops.
The exit loop block will exit a loop and proceed to the next block in the program.
The if…do block is for decision-making: if the condition inserted at right is true, the enclosed code in the do section will execute. If the condition is not true, the do section will be skipped over and not executed.
The if…do block is a mutating block, indicated by the gear which you can click. It allows the block to include multiple “else” and “else if” conditions. If the first condition is not true, its enclosed code will be skipped and the next else if or else conditions will be evaluated and executed if true, before exiting the outer block.
The switch…case block looks at the value of the item attached at switch, jumps down to its matching case, and executes the code enclosed in that case’s do section. Click the gear to add additional case conditions. The break option is selected by default. If it is not selected, the program will continue to execute the code enclosed by the cases below it until it runs into a checked break. If a default is provided, it will execute the code enclosed in the default’s do section if none of the other cases match switch’s value.
The wait block forces the program to halt and wait for a specified amount of time before continuing to the next block.
The add comment block will add a comment or note to the program. This block does not affect the way the program runs. It is simply a way to write a note in the program to help others understand the program. Blank separator is another option from the drop-down menu on the block:
Blank separator turns the block into a blank white block. Just like adding a comment, using a blank separator does not affect your program. You can use it to create a visual separation between parts of your program. The block can be changed back to an add comment block by clicking on the triangle and selecting comment.