Other operators

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

What are they?

See them below:

OperatorExampleAction
isNullisNull(expressionOf("@{context}")The operator verifies if the parameter is null.
isEmptyisEmpty(expressionOf("@{context}")The operator receives an input and verifies if it is empty.
lengthlength(expressionOf("@{context}")The operator receives an input and returns the length.

Example

The example below shows a context with numbersArray ID with the value [0, 1, 2, 3, 4] and the operation length was used in the Text component to get the length of this array, see below:

fun screen() = Screen(
  child = Container(
            context = ContextData(id = "numbersArray", value = arrayOf(0, 1, 2, 3, 4)),
            children = listOf(
                Text(text = "Array [0, 1, 2, 3, 4] has size: "),
                Container(
                    children = listOf(
                        Text(length(expressionOf("@{numbersArray}")).toBindString())
                    )
                ).setStyle { backgroundColor = "#00FF00" }
            )
        )
    )