Programming MisconceptionsHomeMisconceptionsConceptsLanguagesTextbooksContributorsAbout
HomeConcepts
Scope

Scope

The scope of a name is the region of source code in which the name can be used.

Related concepts:  NameLifetime

Closest Wikipedia entry:  Scope (computer science)

Authoritative Definition

Wikipedia does not necessarily offer the best fitting definition of a concept. The exact meaning we attribute to the concept of Scope is based on principled authoritative sources such as:

Compilers: Principles, Techniques, and Tools - Sections 1.6.3, 1.6.5

Misconceptions about Scope
7 documented Misconceptions

Any LanguageJavaJavaScriptPythonScratch
Check Yourself
Misconception
ControlledLocalAccess — Java
One can control access to local variables using access modifiers
Misconception
ForVariableScopeBeyondLoop — Java
The scope of variables declared in a for loop header extends beyond the loop
Misconception
LoopBodyScopeImpliesLoopLifetime — Java
Lifetime of variables declared in a loop body extends across all loop iterations
Misconception
UnqualifiedNamesMustDiffer — Java
The unqualified names of different classes must be different
Misconception
FunctionsCannotBeImmediatelyInvoked — JavaScript
Functions cannot be called in the expression in which they are defined
Misconception
FunctionsMustBeNamed — JavaScript
Every function definition requires an associated name
Misconception
NoGlobalObject — JavaScript
There isn't a global object

Find Misconceptions by...

Concept
Programming Language
Notional Machine
Textbook

About

About This Site
Structure and Content of the Inventory
Contributors