Skip to content

Instantly share code, notes, and snippets.

@chetkhatri
Created July 25, 2019 13:46
Show Gist options
  • Save chetkhatri/73038fad730c9ad48b1c0ef9971b26f4 to your computer and use it in GitHub Desktop.
Save chetkhatri/73038fad730c9ad48b1c0ef9971b26f4 to your computer and use it in GitHub Desktop.
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