fold
Folds the result into a single value by applying the appropriate function.
val message: String = result.fold(
onSuccess = { data -> "Received ${data.size} bytes" },
onFailure = { error -> "Error: ${error.message}" }
)Content copied to clipboard
Return
The result of applying the appropriate function.
Parameters
on Success
The function to apply if this is a success.
on Failure
The function to apply if this is a failure.