Hi guys, I would like to set a flag using a closure so that the internal value of that closure is preserved for me to retrieve it when different events occur. It is one of those times where lack of block scope will stop me from doing what I want to do unless I can set a boolean and preserve its value in a function.
Thanks so much oddz, I was a C++ developer and I am having some problems adjusting to no block scope and using closure instead of classes and private member variables, this has solved it! Have a great weekend
Hi there I don’t seem to be able to get this function to return correctly, I know it returns true then false alternately but I can’t pass boolean parameters in ,
Ok That seems ok to understand but what do you suggest as an alternative? I want to retain a value from outside a function, shall I just go back to creating it as an attribute of an object?