Conditions with `if`
Learn how to use Kotlin's `if` conditions as well as comparison and logical operators.
We'll cover the following
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
#
Conditions with if
can be written as follows:
Create a free account to view this lesson.
By signing up, you agree to Educative's Terms of Service and Privacy Policy