Tutorial ke: 002

TENTANG REPEAT UNTIL

  

program berputar;

uses crt;

var
   jalan       : string[2];
   kolom,baris : byte;
   lambat      : byte;

begin
     clrscr;

     jalan := 'ka';
     baris := 2;
     kolom := 1;

     repeat
          gotoxy(kolom,baris+1);
          write('           ');
          gotoxy(kolom,baris-1);
          write('           ');

          gotoxy(kolom,baris);
          write(' SMA DEMPO ');

          if jalan = 'ka' then kolom := kolom + 1;
          if jalan = 'ki' then kolom := kolom - 1;
          if jalan = 'ba' then baris := baris + 1;
          if jalan = 'at' then baris := baris - 1;

          if (jalan='ka') and (kolom=69) then jalan := 'ba';
          if (jalan='ba') and (baris=23) then jalan := 'ki';
          if (jalan='ki') and (kolom=1)  then jalan := 'at';
          if (jalan='at') and (baris=2)  then jalan := 'ka';

          for lambat:=1 to 3 do
          delay(15000);

     until keypressed;

end.


  
sebelum...     berikut...  

Keterangan: