I'm new for Kotlin. I did search and read the docs but couldn't figure out What the best data type to use in Kotlin for currency. In Java there is BigDecimal. Is there something similar in Kotlin? Thanks in advance.
You can use BigDecimal in kotlin too.
var num1 : BigDecimal? = BigDecimal.ZERO
var num2 = BigDecimal("67.9")
Also you can use Double data type and then you can use toBigDecimal() for convert it to BigDecimal.
For the more details :- https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/to-big-decimal.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With