I'm new to Kotlin and came from JS. I am currently making a calculator app and am working on the '%' operator. I need to find out if the output of the 'current input * 0.01' is a whole number or with decimal points. Usually, I would use
num % 1 !== 0
but it does not work in Kotlin and gives me the error "!= operator cannot be applied to Double or Int". It is the same for Strings or Characters. My Kotlin code is below, hope someone can help! Thanks!
val percentResult: Double() = result.toDouble() * 0.01
if(percentResult % 1 != 0) {
result = (NumberFormat.getInstance().format(percentResult)).toString()
} else {
result = percentResult.toInt().toString()
}