Fundamentals3 / 8
Up next

if and the ternary

let n = 7
// classic if / else
if n % 2 == 0 {
    print("even")
} else {
    print("odd")
}
// the ternary picks one of two values
let sign = n >= 0 ? "positive" : "negative"
print(sign)
What you're solving

branching and the ?: operator