2016-02-29 04:53:03 -05:00
|
|
|
import simple_print:*
|
2015-05-18 04:46:03 -04:00
|
|
|
|
|
|
|
|
fun test(): void {
|
|
|
|
|
println(9)
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-22 22:30:25 -04:00
|
|
|
fun test2(toPrint: int): void {
|
|
|
|
|
println(toPrint)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun test3(): fun():void {
|
|
|
|
|
return test4;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun test4(): void {
|
|
|
|
|
println(11)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun doIt(fun: fun():void):void {
|
|
|
|
|
fun()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun itToBeDone():void {
|
|
|
|
|
println(12)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun doItParam(fun: fun(int):void, param:int):void {
|
|
|
|
|
fun(param)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun itToBeDoneParam(param:int):void {
|
|
|
|
|
println(param)
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-18 04:46:03 -04:00
|
|
|
fun main(): int {
|
|
|
|
|
var val = test
|
2015-05-22 22:30:25 -04:00
|
|
|
var val2: fun():void = test
|
2015-05-18 04:46:03 -04:00
|
|
|
val()
|
2015-05-22 22:30:25 -04:00
|
|
|
val2()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var val3 = test2
|
|
|
|
|
var val4: fun(int):void = test2
|
|
|
|
|
val3(7)
|
|
|
|
|
val4(8)
|
|
|
|
|
|
|
|
|
|
test3()()
|
|
|
|
|
doIt(itToBeDone)
|
|
|
|
|
doItParam(itToBeDoneParam, 13)
|
|
|
|
|
var indrdo = doItParam
|
|
|
|
|
var indrdoParam = itToBeDoneParam
|
|
|
|
|
indrdo(indrdoParam, 14)
|
2015-05-18 04:46:03 -04:00
|
|
|
return 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|