Jump to content

Control variable (programming)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by BernardoSulzbach (talk | contribs) at 20:05, 9 November 2018 (Removed a reference to a book which does not talk about control variables in the context of programming, included a rewording of the textbook definition). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

A control variable in computer programming is a program variable that is used to regulate the flow of control of the program.

In definite iteration, control variables are variables which are successively assigned (or bound to) values from a predetermined sequence of values.[1]

Usage

A loop control variable is used to regulate the number of times the body of a program loop is executed; it is incremented (or decremented when counting down) each time the loop body is executed. A single control variable can identify the present state of a computer program.

References

  1. ^ Watt, David A. (2004). Programming Language Design Concepts. Wiley. p. 84.