Control variable (programming): Difference between revisions
Appearance
Content deleted Content added
m →Special rules: Should split a long sentence into two smaller sentences |
Disambiguated: Pascal → Pascal (programming language); Help needed: Ada |
||
Line 6: | Line 6: | ||
== Special rules == |
== Special rules == |
||
In some programming languages control variables are just ordinary variables used for manipulating the program flow. This is the case of [[C (programming language)|C]], [[Fortran]], and [[Pascal]], which allow for control variables to have their values changed within the loop body.<ref name="Watt"/> However, some languages have special rules for control variables. In [[Ada]], for instance, the control variable of the for loop must remain constant within the loop body. |
In some programming languages control variables are just ordinary variables used for manipulating the program flow. This is the case of [[C (programming language)|C]], [[Fortran]], and [[Pascal (programming language)|Pascal]], which allow for control variables to have their values changed within the loop body.<ref name="Watt"/> However, some languages have special rules for control variables. In [[Ada]]{{dn|date=November 2018}}, for instance, the control variable of the for loop must remain constant within the loop body. |
||
== References == |
== References == |
Revision as of 12:12, 10 November 2018
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]
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, which allow for control variables to have their values changed within the loop body.[1] However, some languages have special rules for control variables. In Ada[disambiguation needed], for instance, the control variable of the for loop must remain constant within the loop body.