cpp-peglib/language/samples/closure.cul

18 lines
199 B
Plaintext
Raw Normal View History

/*
* Closure test
*/
make_func = fn (mut x) {
mut n = 100
fn () {
n = n + 1
x = x + 1 + n
}
}
f = make_func(10)
2015-07-08 17:15:41 +00:00
puts("1: { f() }")
puts("2: { f() }")
puts("3: { f() }")