Difference between revisions of "Local variable"
From Wiki @ Karl Jones dot com
Karl Jones (Talk | contribs) (Created page with "In computer science, a '''local variable''' is a variable that is given local scope. == Description == Local variable references in the fu...") |
Karl Jones (Talk | contribs) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
− | In [[computer science]], a '''local variable''' is a [[Variable ( | + | In [[computer science]], a '''local variable''' is a [[Variable (computer science)|variable]] that is given [[local scope]]. |
== Description == | == Description == | ||
Line 19: | Line 19: | ||
* [[Non-local variable]] | * [[Non-local variable]] | ||
* [[Programming language]] | * [[Programming language]] | ||
− | * [[Variable ( | + | * [[Variable (computer science)]] |
== External links == | == External links == | ||
* [https://en.wikipedia.org/wiki/Local_variable Local variable] @ Wikipedia | * [https://en.wikipedia.org/wiki/Local_variable Local variable] @ Wikipedia | ||
+ | |||
+ | |||
+ | [[Category:Computer programming]] | ||
+ | [[Category:Computing]] |
Latest revision as of 14:13, 26 August 2016
In computer science, a local variable is a variable that is given local scope.
Description
Local variable references in the function or block in which it is declared override the same variable name in the larger scope.
In programming languages with only two levels of visibility, local variables are contrasted with global variables.
On the other hand, many ALGOL-derived languages allow any number of nested levels of visibility, with private variables, functions, constants and types hidden within them, either by nested blocks or nested functions.
Local variables are fundamental to procedural programming, and more generally modular programming: variables of local scope are used to avoid issues with side-effects that can occur with global variables.
See also
- Computer programming
- Computer science
- Global variable
- Local scope
- Non-local variable
- Programming language
- Variable (computer science)
External links
- Local variable @ Wikipedia