Scope (computer Science)

Scope (computer Science)

In computer programming, a scope is the context within a computer program in which a variable name or other identifier is valid and can be used, or within which a declaration has effect. Outside of the scope of a variable name, the variable's value may still be stored, and may even be accessible in some way, but the name does not refer to it; that is, the name is not bound to the variable's storage.

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. In languages like C++, accessing an unbound variable does not have well-defined semantics and may result in undefined behavior; and declarations or identifiers used outside their scope will generate syntax errors.

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

Read more about Scope (computer Science):  Scope Outside A Function, Lexical Scoping and Dynamic Scoping, Qualified Identifiers

Famous quotes containing the word scope:

    Revolutions are notorious for allowing even non- participants—even women!—new scope for telling the truth since they are themselves such massive moments of truth, moments of such massive participation.
    Selma James (b. 1930)