summaryrefslogtreecommitdiff
path: root/sources/examples/futures.scala
diff options
context:
space:
mode:
Diffstat (limited to 'sources/examples/futures.scala')
-rw-r--r--sources/examples/futures.scala12
1 files changed, 12 insertions, 0 deletions
diff --git a/sources/examples/futures.scala b/sources/examples/futures.scala
new file mode 100644
index 0000000000..1e218351af
--- /dev/null
+++ b/sources/examples/futures.scala
@@ -0,0 +1,12 @@
+package examples;
+import concurrent.ops._;
+module futures {
+ def someLengthyComputation = 1;
+ def anotherLengthyComputation = 2;
+ def f(x: Int) = x + x;
+ def g(x: Int) = x * x;
+ val x = future(someLengthyComputation);
+ anotherLengthyComputation;
+ val y = f(x()) + g(x());
+ System.out.println(y);
+} \ No newline at end of file