Skip to content

Instantly share code, notes, and snippets.

@dkomanov
Created May 22, 2020 21:55
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 dkomanov/36f9cfbee097e7f3a6b0f0f138bbc29a to your computer and use it in GitHub Desktop.
Save dkomanov/36f9cfbee097e7f3a6b0f0f138bbc29a to your computer and use it in GitHub Desktop.
[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