Answers for "ternary operator swift"

0

swift ternary statement

myBool = str1 != nil ? true : false
print(myBool)
Posted by: Guest on May-04-2020
0

ternary operator swift

let a = 10

// Note that the space after the question mark
// is required! If you don't do this, the compiler
// will think you're trying to use optional chaining.
let result = a > 5 ? true : false // true
Posted by: Guest on February-10-2021
0

Swift Ternary Operator

// program to check pass or fail
let marks = 60

// use of ternary operator
let result = (marks >= 40) ? "pass" : "fail"

print("You " + result + " the exam")
Posted by: Guest on May-09-2021
0

ternary operator swift 5

// Ternary operator ==>
 // value = condition ? valueIfTrue : valueIfFalse
Posted by: Guest on May-25-2021

Code answers related to "Swift"

Browse Popular Code Answers by Language