Logic operator


What are they?

OperatorsExampleAction
condition“@{condition()}”Conditional operator that evaluates two elements and verifies which condition is true.
not“@{not()}”negation operator that has as input only one value and its function is invert this value.
and“@{and()}”Operator that receives two inputs and it has a TRUE value, if the two values of the operation inputs are TRUE, if not the result is FALSE.
or“@{or()}”Operator that receives two inputs and it the result it a TRUE value. If only ONE of the two input values are TRUE, if not the result is FALSE.

Example

Here is an example of a screen that uses two logical operation condition and or, if the result of the condition or is true, the text of the component text becomes true, if it is false it attibutes the value false to the text:

fun screen() = Screen(
    navigationBar = NavigationBar(title = "Operations", showBackButton = true),
    child = Container(
        children = listOf(
            Text(text = "The text in green bellow will show if the result of `TRUE OR FALSE"),
            Text(
                expressionOf("@{condition(or(true, false), 'true', 'false')}")
            ).applyStyle(Style(backgroundColor = "#00FF00"))
        )
    )
)


Last modified February 12, 2021: Fix/migrate images to aws (#299) (a7bb5457)