swift ternary conditional operator code example
Example 1: swift ternary statement
myBool = str1 != nil ? true : false
print(myBool)
Example 2: ternary operator swift 5
// Ternary operator ==>
// value = condition ? valueIfTrue : valueIfFalse
myBool = str1 != nil ? true : false
print(myBool)
// Ternary operator ==>
// value = condition ? valueIfTrue : valueIfFalse