Starts a loop that executes a finite number of times
for Variable := Integer Expression to|downto Integer Expression do Statement;
for Variable := Char Expression to|downto Char Expression do Statement;
for Variable := Enum Expression to|downto Enum Expression do Statement;
The For keyword starts a control loop, which is executed a finite number of times.
The Variable is set to the result of the 1st Expression. If the result is less than or equal to the result of the 2nd Expression (when to is specified), then the Statement is executed. Variable is then incremented by 1 and the process is repeated until the variable value exceeds the 2nd expression value.
For downto, the variable value is checked as being greater than or equal to the 2nd expression, and its value is decremented at the loop end.
The Expressions may result in any Ordinal type - Integers, Characters or Enumerations.
The Statement maybe a single line, or a set of statements with a begin/end block.
The loop Variable value is not guaranteed by Delphi at loop end. So do not use it!