Skip to content

Instantly share code, notes, and snippets.

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