See below the comparison operator:
Operators | Example | Action |
---|---|---|
gt (greater) | gt(constant(3), constant(4)) | The operator receives two inputs and the result is true if the first value is greater than the second. |
gte (greater than or equal to) | gte(constant(3), constant(4)) | The operator receives two inputs and the result is true if the first value is greater or equal to the second. |
lt (less) | lt(constant(3), constant(4)) | The operator receives two inputs and the result is true if the first value is less than the second. |
lte (less than or equal to) | lte(constant(3), constant(4)) | The operator receives two inputs and the result is true if the first value is less or equal to the second. |
eq (Equal to) | eq(constant(4), constant(4)) | The operator receives two inputs and the result is true if the two values are equal. |
The example here is a screen that uses the comparison operation lt, it verifies the value counter sum and there are two possibilities:
or
is true, the Text
component’s text becomes true;fun screen() = Screen(
navigationBar = NavigationBar(
title = "Operations",
showBackButton = true
),
child = Container(
children = listOf(
Text(text = constant("The text bellow will show if 4 is below 5 or not")),
Container(
children = listOf(
Text(
condition(
lt(constant(4), constant(5)), constant("less then 5"),
constant("greater then 5")).toBindString()
)
)
).setStyle { backgroundColor = constant("#00FF00") }
)
)
)
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.