if-else

Kotlin’s if-else statements are expressions, not keywords. Which means they can have a value. Consider this example where an if-else expression is used to initialize a variable:

val str: String = if (num < 10) "Lower than 10" else "Equal or greater than 10"
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.71.94