if/else basics
Learn the basics of if/else conditions, truth checks, and nesting in Swift.
Intro
if/else lets you run code based on conditions. Swift requires a Bool expression inside if.
Simple if
A simple if runs its block when the condition is true.
let age = 20
if age >= 18 {
print("Adult")
}