Control Blocks

Overview

The control blocks are code blocks or segments that control the flow of the app. These blocks are used to manage the order in which different parts of the code execute. They typically include structures like conditionals and loops, which help determine when certain actions or commands should be carried out based on specific conditions.

The "navigate to screen" block takes the user to the defined screen.

Video Tutorial

How to Change Thunkable Screens with a Button Click

In this tutorial, you’ll learn how to use the "navigate to screen" block to allow your app’s users to navigate between app screens with a simple button click.

If, Do and If, Do, Else

The "if, do" and "if, do, else" blocks allow you to make decisions in your app. They execute certain actions if a condition is true and different actions if the condition is false.

To transform the "if, do" block to support more complex logic:

  1. Click the plus icon next to the "if" statement, this will add an additional "else if" statement.

  2. Click the plus icon next to the "do" statement, this will add an additional "else" statement.

  3. To remove an "else" or "else if" statement, click on the minus sign next to statement you wish to remove.

A truthy value is a value that is considered true when encountered in a Boolean context. All values are true unless they are defined as false. That is, all values are truthy except false, 0, "", null, undefined, and NaN.

Returns False:

Returns True:

Wait [1] Seconds

Wait the specified amount of time before performing the next action.

Loops Blocks

Loop control blocks allow you to execute a set of commands multiple times. They are helpful for tasks that need to be repeated, such as iterating through a list of items.

Forever

Repeat the action for an unlimited period.

Repeat [10] Times

Repeat the action the specified number of times.

Count with i from [1] to [10] by [1]

Repeat the action a specified number of times with the incrementer index i.

For Each Item j in List

Repeat the action over every item in a list.

Repeat While

Repeat the action while a condition is true.

Break out of Loop

Break out of an existing loop.

Test, If True, If False

This block can return a value based on a given condition. If the condition is true, one value is returned. If the condition is false, a different value is returned.

The "open link" block opens an installed app or a URL in the device's browser. If the device has the relevant app installed, the link will open in the app. Otherwise, the link will open in the browser.

Last updated