Conditional
Last updated
Last updated
Conditional statements are used to activate different functions based on the evaluation of a boolean(true/false).
The structure we are using is If - Then - Else.
A simple example:
IF
Today is Monday,
Then
Wake up at 7:00am,
Else
Wake up at 6:00am.
This means that every Monday(true), we will wake up at 7:00am but every other day(false) we will wake up at 6:00am.
If What would you like to evaluate?
Then What would you like to do if the above is true?
Else Otherwise, perform the following...
In this example, we have a variable which is an array, we then use the Expression Builder to create the condition to run this Function. In this case, we check:
if
the
first element of the array
is
1
If this is true, then we create a new variable called new_var
which is set with the value of "hello"
.
If the condition is false, then we create a new variable called new_var
which is set with the value of "hello world"
.
Either way, the variable new_var
will contain the outcome of the conditional statement.