AI Features

Conditions with `if`

Learn how to use Kotlin's `if` conditions as well as comparison and logical operators.

For conditional control flow, Kotlin uses the if and when keywords. The syntax of if-blocks is the same as in C and Java. Similarly, the when keyword is similar to switch in these languages but more powerful, as you will learn.

Conditions using if

...
Ask