Problems with functions scopes


Why do a code like this one :

var a = 0
def printA()

Doesn’t work ?
It says :

Can not find object: a


Functions cannot access variables outside of their scope. If you want a global variable you can do:

GLOBAL a = 0
def printA() {


Or you can make a lambda and bind it:

var printA = fun[a]() {

Or you can take a parameter and bind something like that:

var a = 0

def printA(aparam) { print(aparam); }
var printABound = fun[a]() { printA(a); }


Okay :slight_smile: So that wasn’t a bug, I was trying to do that because it’s possible in many languages like C++ or Python.
Are you gonna implement that or not ?
If not I’ll go with the methods you gave me, thanks :slight_smile:


No, it won’t be implemented, it would be a big change from existing behavior.


Okay, thanks for the answers :slight_smile: