summaryrefslogblamecommitdiff
path: root/docs/examples/futures.scala
blob: 79682b5b76514c40121ef284b31250ec47299542 (plain) (tree)
1
2
3
4
5
6
7
8
9
                
 
                       

                



                                   

                                         


                                          

                      
 
package examples

import concurrent.ops._

object futures {
  def someLengthyComputation = 1
  def anotherLengthyComputation = 2
  def f(x: Int) = x + x
  def g(x: Int) = x * x

  def main(args: Array[String]): Unit = {
    val x = future(someLengthyComputation)
    anotherLengthyComputation
    val y = f(x()) + g(x())
    Console.println(y)
  }
}