I keep getting this can you guys look at my code and see whats up

PROGRAM LargeandSmall;
USES Wincrt;
{*----------------------------------------------------------------------*/
var
        Nums:Array[1..10] of INTEGER;
        Largest:INTEGER;
        Smallest:INTEGER;
        menuchoice:INTEGER;
        i:INTEGER;
        anykey:CHAR;
{*-----------------------------------------------------------------------*/
PROCEDURE initialise;
VAR
        i:INTEGER;
BEGIN
        FOR i:=1 to 10 DO
                num[i]:=0
        Largest:=0;
        Smallest:=32767;
End;
{*-----------------------------------------------------------------------*/
FUNCTION get_menu_choice;
VAR
        i:INTEGER;
        choice:integer;
Begin
        FOR i:=1 to 10 DO
                Writeln;
        Writeln('              LARGE & SMALL MENU');Writeln;Writeln;
        Writeln('              1.  Ten numbers')Writeln;
        Writeln('              2.  Any numbers, terminate with 999');Writeln;
        Writeln('              3.  Exit');Writeln;Writeln,Writeln;
        Writeln;Writeln;Writeln;Writeln;
        Write('Please enter your choice:');
        Readln(choice)
        get_menu_choice:=choice;
End
{*------------------------------------------------------------------------*/
Function getnum;
VAR

        num : INTEGER;
        i : INTEGER;
BEGIN
        Repeat
                FOR I:=1 to 10 DO
                        Writeln;
                Write('Enter a number: ');
                Readln (num);
                If num <=0 THEN
                BEGIN
                        Writeln('Invalid number, try again');Writeln;
                        Writeln;Writeln;Writeln;
                End;
        UNTIL num>0
        getnum:=num;
END
{*-------------------------------------------------------------------------*/
BEGIN
        REPEAT
                initialise
                menuchoice:=get_menu_choice;
                CASE menuchoice OF
                1:      BEGIN
                        FOR I:=1 to 10 DO
                                BEGIN
                                num[i]:=getnum
                                IF nums[i]>Largest THEN
                                        Largest:=num[i];
                                IF nums[i]<Smallest THEN
                                        Smallest:=nums[i];
                                END;
            End;
                2:       BEGIN
                         i:=0;
                         nums[i]:=getnum
                         While nums[i]<>999 DO
                                BEGIN
                                IF nums[i]>Largest TEN
                                        Largest:=nums[i];
                                IF nums[i]<Smallest THEN
                                        Smallest:=nums[i];
                                i:=i+1;
                                nums[i]:=getnum;
                                END
                         Writeln;Writeln;Writeln;
                         Writeln('          The largest numbers is: ',Largest);
                         Writeln;Writeln;Writeln;
                         Writeln('          The smallest numbers is: ',Smallest;
                         Writeln('Press any key to return to menu');
                         anykey:=readkey;
                         END;
                3:       Writeln('Exit chosen.....');
                OTHERWISE:
                        Writeln('Incorrect selection, try again');Writeln;
        UNTIL menuchoice=3;
END.

How about you to try to debug your code?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.