mirror of
https://github.com/yhirose/cpp-peglib.git
synced 2025-01-22 21:35:29 +00:00
18 lines
193 B
Plaintext
18 lines
193 B
Plaintext
|
/*
|
||
|
* Closure test
|
||
|
*/
|
||
|
|
||
|
make_func = fn (mut x) {
|
||
|
mut n = 100
|
||
|
fn () {
|
||
|
n = n + 1
|
||
|
x = x + 1 + n
|
||
|
}
|
||
|
}
|
||
|
|
||
|
f = make_func(10)
|
||
|
|
||
|
pp("1: { f() }")
|
||
|
pp("2: { f() }")
|
||
|
pp("3: { f() }")
|