How would you write if-else in Kotlin?
Kotlin has the following conditionals:
Let's see an example
fun main(>
{
val x = 5
val y = 6
if (x > y>
{
println("x is greater than y">
}
else
{
println("y is greater than x">
}
}
Output
Try it here
What is Kotlin DSL?
The Navigation component provides a Kotlin-based domain-specific language, or DSL, that relies on Kotlin's type-safe builders. This API allows you to declaratively compose your graph in your Kotlin code, rather than inside an XML resource. This can be useful if you wish to build your app's navigation dynamically.
Kotlin in Action :