easy5 pts · first answer countsswiftoptionals
Giving an optional a default
What is the value of name when user.nickname is nil?
let name = user.nickname ?? "Guest"
Discussion 0
Join free to post in the discussion.
Related questions
- Safely unwrapping a Swift optionalMobile App Developer
- Swift struct assignment copiesMobile App Developer
- Swift class shared referenceMobile App Developer
- Decoding JSON with extra keysMobile App Developer
- let compared with varMobile App Developer
- What guard let is forMobile App Developer
- Type of an optional chainMobile App Developer
- Force unwrapping nilMobile App Developer