Created
July 25, 2019 13:46
-
-
Save chetkhatri/73038fad730c9ad48b1c0ef9971b26f4 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
import scala.concurrent.{Await, Future} | |
import scala.concurrent.ExecutionContext.Implicits.global | |
import scala.concurrent.duration._ | |
object FutureExample2 extends App { | |
val printF = Future { println("Hi there!") } | |
val futureObject = for { | |
_ <- printF | |
_ <- printF | |
} yield () | |
Await.result(futureObject, 1 seconds) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment