Result type
A value that holds either a success with its data or a failure with its error.
Definition
Instead of throwing, a function can return a result: Swift's Result<Success, Failure>, Kotlin's Result or a custom sealed type, or a hand-written sealed interface in Java. Results are useful when a failure has to be stored, passed through callbacks or collected, for example in UI state. Kotlin's runCatching catches every Throwable, including coroutine cancellation, so use it carefully.
In practice
A validation step returns a list of results so the form can show every invalid field at once.