Local+and+Global+Variables

In [|computer science], a **local variable** is a [|variable] that is given //local [|scope] //. Such a variable is accessible only from the [|function] or [|block] in which it is declared.

In [|computer programming], a **global variable** is a variable that is accessible in every [|scope] (unless shadowed). Interaction mechanisms with global variables are called **global environment** (see also **global state**) mechanisms. The global environment paradigm is contrasted with the [|local environment] paradigm, where all variables are [|local] with no __[|shared memory] __ (and therefore all interactions can be reconducted to[|message passing] ).