summaryrefslogblamecommitdiff
path: root/sources/examples/futures.scala
blob: 905d3606120309b6c09ccd74730f29a62d7d3032 (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)
  }
}