Skip to content

Instantly share code, notes, and snippets.

@dkomanov
Created May 22, 2020 21:55
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
[writing-async-app-in-scala-part-1] async if-statement
def condition: Future[Boolean] = ...
def action1(): Future[Unit] = ...
def action2(): Future[Unit] = ...
condition.flatMap(
if (_)
action1()
else
action2()
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment