Excellent work! In this lesson, we’ve learned the following concepts:
ifstatement consists of a condition and code block that executes when the condition is
elsestatement is immediately followed by a code block that executes when all previous conditions were
- A code block is denoted by a set of curly braces
else ifstatements can be chained within an
elseto provide additional conditions.
- Comparison operators include
!=and are used to compare the values of two operands.
switchstatement looks for the value of a case that matches the value of an expression.
switchstatement can have cases that contain multiple items known as compound cases.
switchstatement’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.