Logic Puzzles

These puzzles provide conditional expressions to perform different computations or actions depending on whether a condition is met.

Logic visual programming blocks


Puzzles Reference

if / else

With these puzzles, you can implement branching (control flow) in your puzzles.

if-else visual programming block

Suppose, you got a cube and a sphere in your scene. When the user clicks on the sphere, you want to hide it, but only if the user has clicked on the cube before. Such a scenario can easily be implemented with a variable for remembering if the cube has ever been clicked:

if-else example script

Sometimes you need to compare a variable with multiple values, and thus need more branches. In this case, you can expand the if puzzle by clicking on the gear icon and dragging out more slots: elseif or else.

Code branching with visual programming

As a result, you'll be able to fill up the newly created slots with any actions you want to happen in your scenario:

Complex logic with visual programming


This puzzle compares two values and outputs a logical value as the result of comparison.

Comparing values in visual logic editor

Instead of explicitely using the true / false values as in the example above, you can leverage any other puzzles such as text to set a value for a variable. In this case, however, you will additionally need the comparison puzzle to be able to check textual values. The result of comparison (true or false) is then supplied to the if / else puzzle:

Comparing example script

Here is a more advanced example: hide the sphere only if the user clicked on the cube 3 times:

Script with complex visual programming comparisons

logical operators AND / OR

You can further detail your comparisons by using the logical AND / OR operators.

Logical AND/OR visual programming operators


Example on using and/or operations

logical operator NOT

You can negate the result of a logical expression (convert true to false and back) by using the logical operator NOT.

Logical NOT visual programming operator


Example on using NOT operator

true / false

The logic puzzles operate with only two values, true and false, also known as Boolean values.

Visual programming block to define boolean values

These values are returned as output by the comparison puzzle, as well as by the logical operators AND / OR and NOT, and supplied as inputs to the branching puzzles if / else and test.


The null value, strictly speaking, is not related to logical algebra. If a variable is set to null, it means it is not set to true or false, but rather left "undecided".

Null visual logic block

You can use null to explicitely initialize a newly created variable.

Examples on using uninitialized values in visual programming


Sometimes you can make your puzzles a bit more compact or more convient to use by leveraging the test puzzle which returns value right away.

Visual programming test operator


Example on using test block

Having Troubles with Puzzles?

Seek help on the forums!