How to use the conditional ternary operator in Kotlin

1 Answer

0 votes
fun main() {
    val age = 18
	
    val isAdult = if (age >= 18) "Yes" else "No"
	
    println(isAdult) 

}

   
      
/*
run:

Yes
  
*/

 



answered May 13, 2025 by avibootz

Related questions

...