The Logic folder in Blockly contains blocks that are used to control the flow of execution of a program.These blocks include conditional statements (such as if and else), loops (such as while and for), and logical operators (such as and, or, and not).

Logic blocks are essential for writing any complex program, as they allow you to control how the program behaves based on different conditions. For example, you can use a conditional statement to check if a variable is equal to a certain value, and then execute different code depending on the result. Or, you can use a loop to repeat a block of code multiple times until a certain condition is met.

If, else, else if

The if, else, and else if statements are conditional statements in programming languages. They are used to control the flow of a program by executing different blocks of code depending on the value of a condition.

The if statement checks if a condition is true. If the condition is true, the code inside the if block is executed. If the condition is false, the code inside the else block (if it exists) is executed.

The else if statement is similar to the if statement, but it allows you to check multiple conditions. If the first condition is false, the second condition is checked. If the second condition is also false, the third condition is checked, and so on. If all of the conditions are false, the code inside the else block (if it exists) is executed.

In Misty Studio you can build your own if-else function by clicking on the gear and dragging else if and else blocks under the if one.

In this case, Misty will check if the condition in the "if-gap" (red) is true. If it is, she will do the action in the "do-gap" (green), if not she will do what's inside the "else-gap" (yellow).

Value comparison

This block allows you to compare two values. If the condition is respected the block will return true, otherwise it will return false. These are useful in multiple event scenarios when you want Misty to perform different actions based on the type of event triggered.

For example, this block could be used as a condition in the if-else block seen previously. You can select his condition by clicking on it.

Case Comparison

This block allows you to compare two inputs and give an output.

And-case: This block will return true if both inputs are true.

Or-case: This block will return true if at least one of the inputs is true.


With this block, you can reverse the value of the input. If the input is true it returns false, if the input is false it returns true.


This block returns either true or false.

In general, returning true or false is a good way to indicate the success or failure of a function, or to control the flow of a program.


The null block is used to represent the absence of a value. It can be used in a variety of situations, such as:

  • When you need to initialize a variable.

  • When you need to return a value from a function, but the function does not need to return a specific value.

  • When you need to pass a value to a function, but the function does not expect a specific value.

In Misty Studio this block simply returns null.


This block checks the condition in the "test-gap" (yellow), if it is true it returns the if-true value (green), if it is false it returns the if-false value (red).

Last updated