Skip to Content
Scala Reactive Programming
book

Scala Reactive Programming

by Rambabu Posa
February 2018
Intermediate to advanced
552 pages
13h 46m
English
Packt Publishing
Content preview from Scala Reactive Programming

Scala Future examples

We have discussed lots of theory so far. It's good to start developing some examples to understand the Scala Future API. Let's start now with the Scala Hello World Future App:

  1. Create a Scala SBT project in your favorite IDE (mine is IntelliJ IDEA):
      Project Name: scala-future-app

build.sbt:

      name := "scala-future-app" 
      version := "1.0" 
      scalaVersion := "2.12.3" 
  1. Create a Scala App:
      object ScalaFutureHelloWorldApp extends App{      }
  1. Create a HelloWorld Future Object:

ScalaFutureHelloWorldApp.scala:

      import scala.concurrent.Future      object ScalaFutureHelloWorldApp extends App{        val helloWordlFuture = Future("Hello World")      }
  1. When we run this program, we can observe the following error:
[error] .../scala-future- app/src/main/scala/com/packt/publishing/concurrent/future/ScalaFutureHelloWolrdApp.scala:8: ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Scala Programming Projects

Scala Programming Projects

Mikael Valot, Nicolas Jorand
Learning Scala

Learning Scala

Jason Swartz
Functional Programming in Scala

Functional Programming in Scala

Runar Bjarnason, Paul Chiusano

Publisher Resources

ISBN: 9781787288645Supplemental Content