CouldnoT Posted May 30, 2020 Share Posted May 30, 2020 (edited) While loop In the while , the condition is checked first before entering the loop, but repeat enters the loop first then it checks the condition. That means repeat always executes its statement(s) once at least, but while loop could prevent entering the first cycle if the condition returns False from the beginning. while loop needs begin end if there are multiple statements that need to be executed in a loop, but repeat does not need begin end, its block (repeated statements) starts from the repeat keyword to the until keyword. Example : var Num: Integer; begin Write('Input a number: '); Readln(Num); while Num > 0 do begin Write('Clanin is noob'); num:= 0; end; Write('Press enter key to close'); Readln; end. The while loop has no loop counter and it will spam the order between begin and end forever, and for that reason we have used the set num to 0 to stop the loop. Edited May 30, 2020 by CouldnoT Link to comment Share on other sites More sharing options...
Clanin3 Posted June 5, 2020 Share Posted June 5, 2020 Topic inactiv. Link to comment Share on other sites More sharing options...
Recommended Posts