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
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
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")
ternary operator swift 5
// Ternary operator ==>
// value = condition ? valueIfTrue : valueIfFalse
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us