Logic
You will use logic when
- you decide to run some part of your app based on some conditions
- you set the value of certain variables based on certain conditions
You can construct logical expression by GROUPing together RULES and chaining them with AND or OR. For example, below we create the following complex condition:
IF ( option = 1 AND ${V.distance} > 100 AND ${V.actor} = ${V.first_actor}) OR ( option = 2 OR (${V.distance} <= 100 AND ${V.actor} = ${V.second_actor}))
As seen above, the left side of a statement can be a control (something that your users interact with) or a variable (something calculated). The right side of a statement can likewise be a scalar (single, fixed value) or a variable (dynamic values).
Don't worry, most typical conditions are very simple - above is just for illustration purposes
To go to a different section of the app after completing a step, add your condition on the TRANSITION tab. For example, below we go to a section called "Play a simple game" based on a selection made by the user:
Transitions allow for notifications post-transition - for example, to display to the user that they could not go to a certain step, to indicate a warning, or to notify of a successful execution:
Logic for conditional variables works in a similar fashion. For example, below we do the following:
TRY IF ${V.fib} <> 0 ${V.fib} = ${V.f1} + ${V.f2} ELSE ${V.fib} = 1 CATCH (whatever error) ${V.fib} = 0