You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
/*
|
|
|
|
* Closure test
|
|
|
|
*/
|
|
|
|
|
|
|
|
make_func = fn (mut x) {
|
|
|
|
mut n = 100
|
|
|
|
fn () {
|
|
|
|
n = n + 1
|
|
|
|
x = x + 1 + n
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
f = make_func(10)
|
|
|
|
|
|
|
|
puts("1: { f() }")
|
|
|
|
puts("2: { f() }")
|
|
|
|
puts("3: { f() }")
|