// retoor <retoor@molodetz.nl>
|
|
|
|
import "scheduler" for Scheduler, Future
|
|
|
|
class Test {
|
|
static run() {
|
|
var localDouble = async { |x| x * 2 }
|
|
var localAdd = async { |a, b| a + b }
|
|
|
|
System.print(await localDouble(5)) // expect: 10
|
|
System.print(await localAdd(3, 4)) // expect: 7
|
|
|
|
var nested = Fn.new {
|
|
var innerFn = async { |x| x * 100 }
|
|
return await innerFn(3)
|
|
}
|
|
System.print(nested.call()) // expect: 300
|
|
}
|
|
}
|
|
|
|
Test.run()
|