Excellent work! In this lesson, we’ve learned the following concepts:

  • An if statement consists of a condition and code block that executes when the condition is true.
  • An else statement is immediately followed by a code block that executes when all previous conditions were false.
  • A code block is denoted by a set of curly braces {}.
  • Multiple else if statements can be chained within an if/else to provide additional conditions.
  • Comparison operators include <, >, <=, >=, ==, and != and are used to compare the values of two operands.
  • A switch statement looks for the value of a case that matches the value of an expression.
  • A switch statement can have cases that contain multiple items known as compound cases.
  • A switch statement’s case can include a range of values using the closed range operator (...).

You’ve covered a major fundamental programming concept used in every program to control the logical flow. Feel free to utilize the empty Review.swift file and output terminal on the right to hone your understanding of conditionals and practice writing Swift code.


Click Up Next when you’re ready to move on.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?