unaryMinus
Returns the negative of this integer number.
Calling from Kotlin
Here's an example of calling this function from Kotlin code:
val number = AnyInt(1)
val result: AnyInt = -number // or number.unaryMinus()
assertEquals(expected = "-1", actual = "$result")
Please note that this function is not available yet for Java users.
Returns the negative of this integer number.
Calling from Kotlin
Here's an example of calling this function from Kotlin code:
val number: NegativeInt = (-1).toNegativeInt()
.getOrThrow()
val result: PositiveInt = -number // or number.unaryMinus()
assertEquals(expected = "1", actual = "$result")
Please note that this function is not available yet for Java users.
Returns the negative of this integer number.
Calling from Kotlin
Here's an example of calling this function from Kotlin code:
val number: NonZeroInt = 1.toNonZeroInt()
.getOrThrow()
val result: NonZeroInt = -number // or number.unaryMinus()
assertEquals(expected = "-1", actual = "$result")
Please note that this function is not available yet for Java users.
Returns the negative of this integer number.
Calling from Kotlin
Here's an example of calling this function from Kotlin code:
val number: PositiveInt = 1.toPositiveInt()
.getOrThrow()
val result: NegativeInt = -number // or number.unaryMinus()
assertEquals(expected = "-1", actual = "$result")
Please note that this function is not available yet for Java users.
Returns the negative of this integer number.
Calling from Kotlin
Here's an example of calling this function from Kotlin code:
val number: StrictlyNegativeInt = (-1).toStrictlyNegativeInt()
.getOrThrow()
val result: StrictlyPositiveInt = -number // or number.unaryMinus()
assertEquals(expected = "1", actual = "$result")
Please note that this function is not available yet for Java users.
Returns the negative of this integer number.
Calling from Kotlin
Here's an example of calling this function from Kotlin code:
val number: StrictlyPositiveInt = 1.toStrictlyPositiveInt()
.getOrThrow()
val result: StrictlyNegativeInt = -number // or number.unaryMinus()
assertEquals(expected = "-1", actual = "$result")
Please note that this function is not available yet for Java users.