Browse topics
Kotlin Basics
Conditional Statements
Control program flow with if, when, break, continue and return.
Conditional StatementsIf Statement in KotlinIf Statement in Kotlin: a complete example program with source code and sample output, explained step by step.Conditional StatementsIf-Else Statement in KotlinThe if statement is used to check a condition. A Kotlin example with source code and sample output.Conditional StatementsIf Expression in KotlinIf Expression in Kotlin: a complete example program with source code and sample output, explained step by step.Conditional StatementsWhen Expression and Its Usage in Kotlin"when" replaces the switch statement in Java. A Kotlin example with source code and sample output.
Related topics
Basic Programs Get started with Kotlin: your first program, variables, and comments. Kotlin Data Types Explore Int, Float, Double, Char, Boolean, String and more, with type conversion. Kotlin Operators Arithmetic, relational, logical, assignment and Kotlin's special operators. Kotlin Input and Output Read input and print output in Kotlin, including the Scanner class. Looping & Controls Repeat work with for, while, do-while and the repeat function. Kotlin Functions Define functions with default, named and vararg parameters, single-expression, local, tailrec and infix functions.