Accessing a function within a function(nested function?) [duplicate]

You cannot, not unless fib returns inner somehow. inner is essentially a local variable inside the scope of fib and you can’t access a function’s locals from outside of it. (That wouldn’t even make sense, since the locals don’t exist except when the function is running. Think about it — would it make sense to access fib‘s c variable from outside of the function?)

Leave a Comment