plus
Adds the other decimal to this one.
Calling from Kotlin
Here's an example of calling this function from Kotlin code:
val x: Decimal = Decimal.parse("1.5")
val y: Decimal = Decimal.parse("1.25")
val result: Decimal = x + y
val expected: Decimal = Decimal.parse("2.75")
check(result == expected)Content copied to clipboard
Calling from Java
Here's an example of calling this function from Java code:
final Decimal x = Decimal.parse("1.5");
final Decimal y = Decimal.parse("1.25");
final Decimal result = x.plus(y);
final Decimal expected = Decimal.parse("2.75");
final boolean check = result.equals(expected);
if (!check) throw new IllegalStateException("Check failed.");Content copied to clipboard