NEW: Learn SwiftUI with my free YouTube video series! >>

The ternary operator

Question 1/12: This code will print "Success" – true or false?

Hint: Click to show.

let phone = "iPhone"
print(phone == "Android" ? "Failure" : "Success")

Return to Review Menu

Buy Testing Swift Buy Practical iOS 12 Buy Pro Swift Buy Swift Design Patterns Buy Swift Coding Challenges Buy Server-Side Swift (Vapor Edition) Buy Server-Side Swift (Kitura Edition) Buy Hacking with macOS Buy Advanced iOS Volume One Buy Advanced iOS Volume Two Buy Hacking with watchOS Buy Hacking with tvOS Buy Hacking with Swift Buy Dive Into SpriteKit Buy Swift in Sixty Seconds Buy Objective-C for Swift Developers Buy Beyond Code