Beagle v1.7 is no longer actively maintained. The documented version you are viewing may contain deprecated functionality. For up-to-date documentation, see the latest version .
Operator | Example | Action |
---|---|---|
sum | “@{sum(3,3)}” | Addition operator for the elements type Int and Double. |
subtract | “@{subtract(4,3)}” | Subtraction operator for the elements type Int and Double. |
multiply | “@{multiply(3,3)}” | Multiplication operator for the elements type Int and Double. |
divide | “@{divide(3,3)}” | Division operator for the elements type Int and Double. |
See an example below of a counter where two buttons increment
and decrement
, both with SetContext actions that modifies the context value that has an id counter, altering the value with addition and subtraction operations, increasing or decresing the value of 1 to the text value:
fun screen() = Screen(
navigationBar = NavigationBar(
title = "Operations",
showBackButton = true
),
child = Container(
context = ContextData("counter", 2),
children = listOf(
Text(expressionOf("Sum of 2 + 1 = @{sum(2, 1)}")),
Text(expressionOf("Counter: @{counter}")),
Button(
text = "increment",
onPress = listOf(
SetContext("counter", "@{sum(counter, 1)}"))
),
Button(
text = "decrement",
onPress = listOf(
SetContext("counter", "@{subtract(counter, 1)}"))
)
)
)
)
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.