Executing:
fansh> counter := 0
0
fansh> f := |->Int| { return ++counter }
|->sys::Int|
fansh> f()
1
2
fansh> echo(counter)
shouldn't echo(counter) say "2" ???
echo(counter)
The way fansh works, it doesn't quite work the way normal code would for local variables. So for testing out closures you should probably use a script
Login or Signup to reply.
tcolar Fri 4 Feb 2011
Executing:
0
|->sys::Int|
1
2
0
shouldn't
echo(counter)
say "2" ???brian Fri 4 Feb 2011
The way fansh works, it doesn't quite work the way normal code would for local variables. So for testing out closures you should probably use a script