Forums
Learn
Careers
Store
About
SUBSCRIBE
GO FURTHER, FASTER: Try the Swift Career Accelerator today! >>
Question 1/12: This code is valid Swift – true or false?
Hint: It might sound obvious, but optional chaining may only be used with optionals. Click to show.
let names = ["Taylor", "Paul", "Adele"] let lengthOfLast = names.last?.count?
Correct! The count property is not optional, so this should read names.last?.count.
count
names.last?.count
Oops – that's not correct. The count property is not optional, so this should read names.last?.count.
Return to Review Menu
You are not logged in
Link copied to your pasteboard.