HOME

TheInfoList



OR:

In
computer programming Computer programming is the process of performing a particular computation (or more generally, accomplishing a specific computing result), usually by designing and building an executable computer program. Programming involves tasks such as ana ...
, a control variable is a
program variable In computer programming, a variable is an abstract storage location paired with an associated symbolic name, which contains some known or unknown quantity of information referred to as a ''value''; or in simpler terms, a variable is a named cont ...
that is used to regulate the
flow of control In computer science, control flow (or flow of control) is the order in which individual statements, instructions or function calls of an imperative program are executed or evaluated. The emphasis on explicit control flow distinguishes an ''imp ...
of the program. In definite iteration, control variables are variables which are successively assigned (or bound to) values from a predetermined sequence.


Special rules

In some programming languages, control variables are just ordinary variables used for manipulating the program flow. This is the case of C, Fortran, and
Pascal Pascal, Pascal's or PASCAL may refer to: People and fictional characters * Pascal (given name), including a list of people with the name * Pascal (surname), including a list of people and fictional characters with the name ** Blaise Pascal, Fren ...
, which allow for control variables to have their values changed within the loop body. However, some languages have special rules for control variables. In
Ada Ada may refer to: Places Africa * Ada Foah, a town in Ghana * Ada (Ghana parliament constituency) * Ada, Osun, a town in Nigeria Asia * Ada, Urmia, a village in West Azerbaijan Province, Iran * Ada, Karaman, a village in Karaman Province, ...
, for instance, the control variable of a for-loop must remain constant within the loop body.


References

Mathematical terminology Computing terminology {{comp-sci-stub