Conditional expressions

Conditional expressions are used for branching program flow. They execute or skip program statements based on the outcome of a conditional test. Conditional statements are the decision-making points of a program.

Kotlin has two main structures for handling branching. These are if expressions and when expressions.

Get Kotlin Programming By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.