mirror of
https://github.com/yhirose/cpp-peglib.git
synced 2024-11-14 06:55:30 +00:00
18 lines
199 B
Plaintext
18 lines
199 B
Plaintext
/*
|
|
* 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() }")
|