for...to, for...downto (reserved words)

Language:
Русский
English

 for...to, for...downto (reserved words)


The for statement causes the statement after do to be executed once for each value in the range first to last.

Syntax

 for var := first to last do
   statement

OR

 for var := first downto last do
   statement

Remarks

The control variable and the initial and final values must be of an ordinal type.

to

With to, the value of the control variable is incremented by 1 for each loop.

downto

With downto, the value of the control variable is decremented by 1 for each loop.

Example

 (* for ... to, for ... downto *)
 for I := 1 to ParamCount do
   WriteLn(ParamStr(I);

 for I := 1 to 10 do
   for J := 1 to 10 do
   begin
     X := 0;
     for K := 1 to 10 do
       X := X + Mat1[I, K] * Mat2[K, J];
     Mat[I, J] := X;
   end;

Тэги: downto for to
| G+
Код для вставки: :: :: :: ::
Поделиться: // //