How to Check Double value is Null or Zero in kotlin
val ratio:Double? = 0.0
val calRatio = if (ratio == null || ratio == 0.0)
0.12
else
ratio
ratio in null , 0.0 , 0.1
if ratio null or 0.0 then return 0.12
and ratio is 0.2 or more then return same ratio value
how to check this algorithm not use if statement
Aucun commentaire:
Enregistrer un commentaire