Top "Scope" questions

Scope is an enclosing context where values and expressions are associated.

Why nested functions can access variables from outer functions, but are not allowed to modify them

In the 2nd case below, Python tries to look for a local variable. When it doesn't find one, why can't …

python scope
Can a js script get a variable written in a EJS context/page within the same file

As I wrote in the title, I'd like to get a value from a variable written into a ejs page/…

javascript scope ejs
C++ Member Variables

Consider the following class: class A { A(); int number; void setNumber(int number); }; You could implement 'setNumber' in 3 ways: Method 1: …

c++ class variables scope member
Python: load variables in a dict into namespace

I want to use a bunch of local variables defined in a function, outside of the function. So I am …

python variables scope locals
Why does a Try/Catch block create new variable scope?

For example: try { SomeObject someObject = new SomeObject(); someObject.dangerousMethod(); } catch(Exception e) { } someObject.anotherMethod(); //can't access someObject! But you can …

java scope try-catch
Static (Lexical) Scoping vs Dynamic Scoping (Pseudocode)

Program A() { x, y, z: integer; procedure B() { y: integer; y=0; x=z+1; z=y+2; } procedure C() { z: integer; procedure …

scope output pseudocode
What do curly braces in Java mean by themselves?

I have some Java code that uses curly braces in two ways // Curly braces attached to an 'if' statement: if(…

java syntax scope curly-braces
Why use a public method in an internal class?

There is a lot of code in one of our projects that looks like this: internal static class Extensions { public …

c# scope public internals
Getting "global name 'foo' is not defined" with Python's timeit

I'm trying to find out how much time it takes to execute a Python statement, so I looked online and …

python scope timeit
How to properly bind scope between directive and controller with angularJS

I'm trying to generate an n-level hierarchical unordered list with anugularJS, and have been able to successfully do so. But …

scope angularjs hierarchy using-directives