Tuesday 7 February 2012

Scope (computer science)

In computer programming, a scope is the context within which a variable-name names its variable, or other identifier identifies what it identifies, or within which a declaration has effect. Various programming languages have various different scoping rules for different kinds of declarations and identifiers. Such scoping rules have a large effect on language semantics and, consequently, on the behavior and correctness of programs.

Scopes are frequently tied to other language constructs, but many languages also offer constructs specifically for controlling scope.