BlocklyProp reference for CONTROL blocks

  Compatible with all Propeller Board types.

The CONTROL blocks in BlocklyProp are used to build the structure of a Blockly program.  Use these blocks to repeat, loop, make decisions, build and use functions, and start up new processors.

add comment

The add comment block allows you to add a comment or note to your code, or a blank separator to visually separate chunks of code, to help a reader or programmer understand what it does. 

  • To add a comment, click in the empty box and type your notes.

  • To add a blank separator, click the dropdown arrow and select blank separator.

The 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 block is a mutating block, indicated by the gear that can be clicked. 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.

If...then...elseif vs The former is more familiar to many programs, but sometimes the latter is a better fit. See the video at below. Here's an example:

if...then always resolves the attached condition to true (1) or false (0).  Imagine a program that needs to determine which button is pressed on a remote.  if...then would be like trying to get information from a person who will only answer yes or no. Imagine  "Did you press button 16? No?  OK, then did you press button 17? No? Okay, well, did you press Button 18? Really? Okay, I'll keep trying..."  You may have to ask a lot of questions until you get a "yes" answer and know which action to take. always resolves the attached condition to a number.  So, instead, you can simply say "What button did you press?" and then go straight to the correct action without further delay. So if...then is a great fit if you need to evaluate a series of conditions and figure out which one is happening.  And is a great fit when you have a variable or equation determining which action to take from a list of numbered choices.

conditional repeat

The conditional repeat block creates a loop that, depending on the option chosen in the menu, repeats forever, __ x times, until __, or while __. With the exception of forever, each of the other options requires a condition to be added that indicates when the loop should end.

  • repeat forever: loops forever.  Only a break block will escape the loop and move on to the rest of the program.
  • repeat __x times: put a block in here to provide the number of times you want the loop to repeat before moving on. Block options are anything that resolves to a number, such as number value, math operation, random, or use variable.
  • repeat until__: put a block in here with a condition to test. Code inside the conditional repeat will run until that condition is true (any number other than 0).
  • repeat while__: put a block in here with a condition to test. Code inside the conditional repeat will run while that condition is true (any number other than 0).

repeat item

The repeat 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 repeat 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 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.

Read about if vs above, and watch the video below.


The break block will exit a loop and proceed to the next block in the program.


The pause block forces the program to halt and wait for a specified amount of time before continuing on to the next block. Provide a number in ms (milliseconds, 1,000 per second) for the amount of time to wait.  This can be a number value block or any other block that resolves to a number.

new processor

Each instance of this block launches a processor automatically.

The new processor block launches a function into its own processor (cog). There are up to 7 processors available on the Propeller. See the BlocklyProp Function and Multicore tutorial for details. Here are some tips for using the new processor block:

  • Only a single run function block can be placed inside this block.
  • Do not use functions that contain Terminal blocks; Terminal blocks and functions containing Terminal blocks can only run from the main program.
  • Some other blocks also launch their own processor automatically—look for the icon.  Be mindful that a total of 7 processors can be launched from one program.


The return block may be placed in an statement inside of a function, to conditionally exit that function early and continue with the rest of the program. A return block is not necessary as the last item enclosed by a define function block.