We've covered if, else if, else, and switch — all great ways to make decisions in Swift. But there's one more tool in the toolkit that's much more compact than all of them. It's called the ternary conditional operator, and at first glance it looks a little strange. Stick with it though — especially when you get to SwiftUI, you'll be glad you learned it. 🌸
You've already used binary operators without realising it. Operators like +, -, == are called binary because they work with two pieces of input:
2 + 5 // two inputs
age >= 18 // two inputs
Enter fullscreen mode






