22 lines
346 B
Plaintext
22 lines
346 B
Plaintext
|
fun makeClosure() {
|
||
|
var local = "local";
|
||
|
fun closure() {
|
||
|
print local;
|
||
|
}
|
||
|
return closure;
|
||
|
}
|
||
|
|
||
|
var closure = makeClosure();
|
||
|
closure();
|
||
|
|
||
|
fun makeClosure2(value) {
|
||
|
fun closure() {
|
||
|
print value;
|
||
|
}
|
||
|
return closure;
|
||
|
}
|
||
|
|
||
|
var doughnut = makeClosure("doughnut");
|
||
|
var bagel = makeClosure("bagel");
|
||
|
doughnut();
|
||
|
bagel();
|