The ternary operator in Swift

Do you remember those notes kids would pass around when we were in middle school asking “Do you like me”?

The ternary operator is the equivalent of them in code.

When you use the ternary operator you’re asking a question that can either be true or false. When it’s true, the code after the “?” gets executed and when it’s false, the code after the “:” gets executed.