Tutorial by Examples

program ForLoopWithContinueAndBreaks; {$APPTYPE CONSOLE} var var i : integer; begin for i := 1 to 10 do begin if i = 2 then continue; (* Skip this turn *) if i = 8 then break; (* Break the loop *) WriteLn( i ); end; WriteLn('Finish.'); end. Outpu...
program repeat_test; {$APPTYPE CONSOLE} var s : string; begin WriteLn( 'Type a words to echo. Enter an empty string to exit.' ); repeat ReadLn( s ); WriteLn( s ); until s = ''; end. This short example print on console Type a words to echo. Enter an empty string to exit....
program WhileEOF; {$APPTYPE CONSOLE} uses SysUtils; const cFileName = 'WhileEOF.dpr'; var F : TextFile; s : string; begin if FileExists( cFileName ) then begin AssignFile( F, cFileName ); Reset( F ); while not Eof(F) do begin ...

Page 1 of 1