Skip to content
CodeWiki
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
Search
⌘K
English
English
Chinese
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
English
English
Chinese
Practice
/
Quiz
/
Swift
/
Optionals
Why does input.flatMap { Int($0) } return Int? instead of Int???
from Optionals
Swift 6.3.3
intermediate
1 min
Why does input.flatMap { Int($0) } return Int? instead of Int???
flatMap accepts an optional-returning transform and flattens the resulting optional layer.
Int(_:) always returns a non-optional integer inside flatMap.
Swift removes every nested optional at compile time.
Check
Ask AI about this kata
Report an error
next kata
Which statement accurately describes String? in Swift?
Quiz
A new version is available
Reload