local variable

local variable

[′lō·kəl ′ver·ē·ə·bəl]
(computer science)
A variable which can be accessed (used or changed) only in one block of a computer program.
McGraw-Hill Dictionary of Scientific & Technical Terms, 6E, Copyright © 2003 by The McGraw-Hill Companies, Inc.

local variable

(programming)
A variable with lexical scope, i.e. one which only exists in some particular part of the source code, typically within a block or a function or procedure body. This contrasts with a global variable, which is defined throughout the whole program.

Code is easier to understand when the scope of variables is as small as possible because it is easier to see how the variable is set and used. Code containing global variables is harder to modify because they create more interdependencies between sections of code.
This article is provided by FOLDOC - Free Online Dictionary of Computing (foldoc.org)

local variable

In programming, a variable used only within the routine or function it is defined in. When the function is finished and control is returned back to the part of the program that called it, the local variables no longer exist. Contrast with global variable.
Copyright © 1981-2025 by The Computer Language Company Inc. All Rights reserved. THIS DEFINITION IS FOR PERSONAL USE ONLY. All other reproduction is strictly prohibited without permission from the publisher.
Mentioned in
Copyright © 2003-2025 Farlex, Inc Disclaimer
All content on this website, including dictionary, thesaurus, literature, geography, and other reference data is for informational purposes only. This information should not be considered complete, up to date, and is not intended to be used in place of a visit, consultation, or advice of a legal, medical, or any other professional.