Content deleted Content added
m Reverted 1 edit by 202.144.136.4 identified as vandalism to last revision by Bakilas. |
No edit summary |
||
Line 1:
In [[computer science]], a '''local variable''' is a [[variable]] that is given ''local [[scope (programming)|scope]]''. Such a variable is accessible only from the [[Subroutine|function]] or [[block]] in which it is declared. Local variables are contrasted with [[global alpha beta segato it. In most languages, these local parameters are treated the same as other local variables within the subroutine. In contrast, ''[[call by reference]]'' and ''[[call by name]]'' semantics allow the parameters to act as aliases of the values passed as arguments, allowing the subroutine to modify variables outside its own scope.
Some advocate that all variables should be of local scope to avoid issues with [[Side-effect (computer science)|side-effects]].
|