|
more than 450 programs for free
|
![]() English |
![]() Slovensky |
![]() Česky |
![]() Šarišsky |
Cycle with condition (with infinity repeate)REPEAT .. UNTIL
REPEAT
command; .. UNTIL (condition); Cycle REPEAT .. UNTIL is based on a fact, that commands can be repeating infinitely times. Repeating will be ended, when a condition inUNTIL will be not acomplished.
Repeat
WriteLn('Press enter if you wanna to continue'); ch:=ReadKey; Until (ch=#13); Program will be writing a text, till the pressed key will not be a ENTER. WHILE
WHILE (condition) DO BEGIN
command; .. END; Commands between BEGIN .. END will be acomplished till the condition in a WHILE will be acomplished. Cycle is like REPEAT .. UNTIL but in this cycle is a condition tested at the beggining, REPEAT..UNTIL are acomplishing once, till WHILE will needn't to acomplished a commands once.
i:=0;
while (i<10) do begin i:=i+1; WriteLn('I=',i); end; Variable i is a counter. At the beggining there is a 0 in a i variable. Condition is testing if i<10. If i<10 then program begin to acomplishing a commands between BEGIN - END. Cycle is repeatin 10 times. <<Previous | Content | Next>> |
|