Kotlin function that returns 0 for negative values and the same value for positive ones

Viewed 560

I'm a bit annoyed with the line of code below. I'm wondering if there are any build-in function in the Kotlin SDK that could do the same in a more elegant way.

val result = if (value > 0) value else 0
1 Answers
Related