Swift

Swift One-Line If-Else

Did you know that you can replace this simple if-else statement in Swift: With this neat one-liner expression? This is possible thanks to what is called a ternary conditional operator in Swift. For your convenience, here is the structure of a ternary operator: Where: A ternary conditional operator offers a shorthand that is a useful way to replace simple if-else statements.

Swift One-Line If-Else Read More »