Comparison operator

You will find here the description of comparison operator

What are they?

OperatorsExampleAction
gt (greater)"@{gt(3,4)}"Operator that receives two inputs and the result is true if the first value is greater than the second one.
gte (greater than or equal to)"@{gte(3,4)}"Operator that receives two inputs and the result is true if the first value is greater than or equal to the second one.
lt (less than)"@{lt(3,4)}"Operator that receives two inputs and the result is true if the first value is less than the second one.
lte (less then or equal to)"@{lte(3,4)}"Operator that receives two inputs and the result is true if the first value is less then or equal to the second one.
eq (Equal to)"@{eq(4,4)}"Operator that receives two inputs and the result is true if the two values are equal.

Example

Here, the example is a screen that uses the comparison operation It, that verifies if the addition value of the counter is:

  • If the result of the condition or is true, the text component Text becomes true;
  • If it is false, it attributes the text the value false;
fun screen() = Screen(
    navigationBar = NavigationBar(
        title = "Operations",
        showBackButton = true
    ),
    child = Container(
        children = listOf(
            Text(text = "The text bellow will show if 4 is below 5 or not"),
            Text(expressionOf(
                    "@{condition(lt(4, 5), 'less then 5', 'greater then 5')}")
            ).setStyle{ backgroundColor = "#00FF00" }
        )
    )
)