Last active
October 30, 2019 23:47
-
-
Save pencelab/b5ba75458c37946ae6918c9e9a890b0f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun sumAverageAsync() = async { | |
val r1 = async { myRandomNumberSuccess(OPERATION_AVERAGE) } | |
val r2 = async { myRandomNumberSuccess(OPERATION_AVERAGE) } | |
val r3 = async { myRandomNumberSuccess(OPERATION_AVERAGE) } | |
val sum = r1.await() + r2.await() + r3.await() | |
log("$OPERATION_AVERAGE: Sum = $sum") | |
sum.toFloat() / 3 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment