Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pencelab/6ed237e0444197910f01c1dd584bef74 to your computer and use it in GitHub Desktop.
Save pencelab/6ed237e0444197910f01c1dd584bef74 to your computer and use it in GitHub Desktop.
private suspend fun sumThreeRandomNumbers(operation: String): Int = coroutineScope {
val r1 = async { myRandomNumberFail(operation) }
val r2 = async { myRandomNumberSuccess(operation) }
val r3 = async { myRandomNumberSuccess(operation) }
r1.await() + r2.await() + r3.await()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment