Control Blocks
Last updated
Last updated
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.
We recommend avoiding placing any additional blocks below the "navigate to screen", "open link" or "send email" blocks because when the app navigates to another screen or exits any subsequent blocks may not have enough time to be executed.
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.
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:
Click the plus icon next to the "if" statement, this will add an additional "else if" statement.
Click the plus icon next to the "do" statement, this will add an additional "else" statement.
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 the specified amount of time before performing the next action.
In general, when blocks are stacked one on top of the other, they are executed simultaneously. To ensure that certain blocks are executed first, you can add a small delay between them. While blocks are asynchronous by nature, they can behave synchronously if you use a "wait" block.
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.
Repeat the action for an unlimited period.
Repeat the action the specified number of times.
Repeat the action a specified number of times with the incrementer index i.
Repeat the action over every item in a list.
Repeat the action while a condition is true.
Break out of an existing loop.
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.