Swift if
Execute code conditionally when an expression evaluates to true.
Basic if
Run code only when a condition evaluates to true.
Example
let temp = 25
if temp > 20 {
print("Warm")
}
Threshold Check
Trigger an action only when a value exceeds a threshold.
Example
let speed = 55
if speed > 50 {
print("Slow down")
}
Leave a Reply