Skip to main content

Conditions and Math

Loading...

This project adds a bit of complexity to the Variables and Arithmetic application of the previous topic. Pressing the MD button will keep incrementing the Counter variable, but the value of this variable will be reset to 1 once it exceeds 10.

Your TPS' MD button was introduced in the Hello, World project.

The value of the Counter variable is limited to 10 using a Condition block. It introduces the flow forking: Comparing the Counter value to 10 results in the execution taking the True or False path in the application's logic.

conditions

The project also demonstrates that two execution paths may converge on a single point. This is known as a join.

conditions

Eagle-eyed readers will also notice another difference from the Variables and Arithmetic application: Rather than relying on the Arithmetic block to perform calculations, this application takes advantage of the more versatile Variable Set/Math block:

conditions

The Variable Set/Math block allows entering math formulas, and these can go way beyond simple addition, subtraction, multiplication, and division offered by the Arithmetic block. The formulas must comply with the syntax of the Tibbo BASIC language. Luckily for AppBlocks' users, this syntax largely follows the "natural" way of writing formulas.