: Greetings,
:
: Question 1:
: How come when I read other ppl's code, I can't seem to understand them? There are just syntax which I neve saw before...
:
: Question 2:
: Well, below is a unit which I'm unable to get running. My compiler keeps on telling me about this error at the end of file, but I can't seem to see the error myself... Please, if anyone does see the error, please tell me what it is.
:
:
: unit menuselection;
:
: interface
: procedure menuselection (var iup, idown, ileft, iright, iintx, iinty, iformat, isummon : integer);
:
: implementation
:
: uses crt;
:
: procedure menuselection (var iup, idown, ileft, iright, iintx, iinty, iformat, isummon : integer);
:
: var iupcount, idowncount, ileftcount, irightcout : integer;
: var ch : char;
:
: begin
: repeat
: ch := readkey;
: gotoxy (iintx, iinty);
: writeln ('*');
:
: if ch = #72 then {down}
: begin
: if idown = 1 then
: begin
: gotoxy (iintx, iinty);
: writeln (' ');
: inty := iinty + 1;
: end
: else
: begin
: end;
: end
: else
if ch = #75 then {left}
: begin
: if ileft = 1 then
: begin
: gotoxy (iintx, iinty);
: writeln (' ');
: iintx := iintx - 1;
: end
: else
: begin
: end;
: end
: else
if ch = #77 then {right}
: begin
: if iright = 1 then
: begin
: gotoxy (iintx, iinty);
: writeln (' ');
: iintx := iintx + 1;
: end
: else
: begin
: end;
: end
: else
if ch = #80 then {up}
: begin
: if iup = 1 then
: begin
: gotoxy (iintx, iinty);
: writeln (' ');
: iinty := iinty - 1;
: end
: else
: begin
: end;
: end
: else
: begin
: end;
:
: repeat until ch = #13;
:
: if ch = #13 then
: begin
: end;
:
: end;
:
:
:
: The only thing that I can see wrong with this program is you forgot to put an [ end. ] at the end of your unit. See below to see corrected code.
:
: unit menuselection;
:
: interface
: procedure menuselection (var iup, idown, ileft, iright, iintx, iinty, iformat, isummon : integer);
:
: implementation
:
: uses crt;
:
: procedure menuselection (var iup, idown, ileft, iright, iintx, iinty, iformat, isummon : integer);
:
: var iupcount, idowncount, ileftcount, irightcout : integer;
: var ch : char;
:
: begin
: repeat
: ch := readkey;
: gotoxy (iintx, iinty);
: writeln ('*');
:
: if ch = #72 then {down}
: begin
: if idown = 1 then
: begin
: gotoxy (iintx, iinty);
: writeln (' ');
: inty := iinty + 1;
: end
: else
: begin
: end;
: end
: else
if ch = #75 then {left}
: begin
: if ileft = 1 then
: begin
: gotoxy (iintx, iinty);
: writeln (' ');
: iintx := iintx - 1;
: end
: else
: begin
: end;
: end
: else
if ch = #77 then {right}
: begin
: if iright = 1 then
: begin
: gotoxy (iintx, iinty);
: writeln (' ');
: iintx := iintx + 1;
: end
: else
: begin
: end;
: end
: else
if ch = #80 then {up}
: begin
: if iup = 1 then
: begin
: gotoxy (iintx, iinty);
: writeln (' ');
: iinty := iinty - 1;
: end
: else
: begin
: end;
: end
: else
: begin
: end;
:
: repeat until ch = #13;
:
: if ch = #13 then
: begin
: end;
:
: end;
: end. <- put [ end. ] here
: