Top "Scope" questions

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

JavaScript: access variables inside anonymous function from the outside

Say I have this anonymous function: (function(window){ var private = 'private msg'; function sayit() { alert(private) // works } document.body.onclick = …

javascript scope anonymous-function
When is it appropriate to set a request-scoped variable in a JSP?

In my experience, it is rarely/never necessary to set scope="request" on an EL variable. For example, I have …

jsp jstl scope lexical-scope dynamic-scope
Does procedural programming have any advantages over OOP?

[Edit:] Earlier I asked this as a perhaps poorly-framed question about when to use OOP versus when to use procedural …

oop object scope procedural-programming
Defining scope for custom Sublime Text 2 snippets

While trying to write my own snippets for Sublime Text 2, I ran into the following two problems: Finding scope keys. …

scope sublimetext2 code-snippets
In Python 2, how do I write to variable in the parent scope?

I have the following code inside a function: stored_blocks = {} def replace_blocks(m): block = m.group(0) block_hash = sha1(…

python closures scope python-2.x
Convert Fraction String to Decimal?

I'm trying to create a javascript function that can take a fraction input string such as '3/2' and convert …

javascript scope fractions
Block scope in Python

When you code in other languages, you will sometimes create a block scope, like this: statement ... statement { statement ... statement } statement ... …

python scope
Variables scope which are defined within a while block in stored procedures - SQl Server

I've come across a interesting scenario (at least for me) in a stored procedure. Would like to have experts opinion …

sql-server sql-server-2008 variables scope declaration
Access self from decorator

In setUp() method of unittest I've setup some self variables, which are later referenced in actual tests. I've also created …

python unit-testing scope
Use external variable in array_filter

I've got an array, which I want to filter by an external variable. The situation is as follows: $id = '1…

php scope array-filter