Logic operators

In this section, you will find the information about Logic operators.

What are they?

See below the logic operators:

OperatorsAction
condition()The condition operator checks two elements and verifies which one is the real condition.
not()The negation operator where the input is a only one value and the function is to reverse this value.
and()The operator receives two inputs and the result is a TRUE value. If the two inputs values are TRUE, if not the result is FALSE.
or()The operator receives two inputs AND the result is a TRUE value, if at least ONE of the two operation inputs is TRUE, if not the result is FALSE.

Example

In this example there is a screen that uses two logic operations, condition and or. There are two possibilities:

  1. If the condition or result is true, the Text component text becomes true.
  2. If it is false it attributes the value false.
fun screen() = Screen(
    navigationBar = NavigationBar(title = "Operations", showBackButton = true),
    fun screen() = Screen(
    navigationBar = NavigationBar(title = "Operations", showBackButton = true),
    child = Container(
            children = listOf(
                Text(text = constant("The text in green bellow will show if the result of `TRUE OR FALSE")),
                Text(condition(or(constant(true), constant(false)), constant(true), constant(false)).toBindString()
                ).setStyle{ backgroundColor = "#00FF00" }
            )
        )
    )
)