Skip to content

Instantly share code, notes, and snippets.

@pencelab
Last active October 30, 2019 23:43
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/6734692070a8c4137a666204623777e2 to your computer and use it in GitHub Desktop.
Save pencelab/6734692070a8c4137a666204623777e2 to your computer and use it in GitHub Desktop.
fun sumIsEvenAsync() = async {
val r1 = async { myRandomNumberSuccess(OPERATION_IS_EVEN) }
val r2 = async { myRandomNumberSuccess(OPERATION_IS_EVEN) }
val r3 = async { myRandomNumberSuccess(OPERATION_IS_EVEN) }
val sum = r1.await() + r2.await() + r3.await()
log("$OPERATION_IS_EVEN: Sum = $sum")
sum % 2 == 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment