Conditional Expressions

Great job getting to the end of this lesson. Let’s review the content we learned:

  • Conditional expressions control the flow of execution in a program.
  • An if expression executes a block of code when the value of its condition is true.
  • An else expression executes code when none of the previous expressions have a true value.
  • Comparison operators like >, <, >=, and <= are used to compare two values to determine a true or false value.
  • The == operator checks if two values are equivalent while the != operator checks if two values are not equivalent.
  • The logical AND operator (&&) returns true when two Boolean expressions being compared are both true.
  • The logical OR operator (||) returns true when at least one Boolean expression being compared is true.
  • The logical NOT operator (!) negates the value of a Boolean expression.
  • else-if expressions are used to add more conditions to a traditional if/else statement.
  • A nested conditional is a conditional that appears inside of another conditional.
  • A when expression evaluates the value of a variable or expression in order to dictate the flow of a program.
  • The range operator .. creates a consecutive succession of values.


Use the space in Review.kt to practice the content learned in this lesson.

When you’re ready to move on, click Up Next.

Folder Icon

Take this course for free

Already have an account?