so lets say i have a program and it keeps on outputting the letter 'A' constantly until the user presses enter or something. then it will exit the loop and continue with the rest of the program. how would i do this?

use break;

could you give me an example? how would i use it?

Hi Killhha
one solution :

{
so lets say i have a program and it keeps on
outputting the letter 'A' constantly until
the user presses enter or something.
then it will exit the loop and continue with
the rest of the program. how would i do this?
}

Program solution;

Uses Crt;

Begin
     Repeat
        Write('A');
     Until KeyPressed;
     WriteLn;
     Write('Press enter to continue..');
     ReadLn;
     Write('Press Enter to quit');
     ReadLn;
End.

{
-=Created By FlamingClaw 2009.06.12=-
}

and the another one... :D

{
so lets say i have a program and it keeps on
outputting the letter 'A' constantly until
the user presses enter or something.
then it will exit the loop and continue with
the rest of the program. how would i do this?
}

Program solution;

Uses Crt;
Var i:Byte;
Begin
     i:=1;
     {the infinite loop}
     While (i<3) Do Begin
        Write('A');
        If (KeyPressed = True) Then Break;
     End;
     {the rest of the main program}
     WriteLn;
     Write('Press enter to continue..');
     ReadLn;
     Write('Press Enter to quit');
     ReadLn;
End.

{
-=Created By FlamingClaw 2009.06.12=-
}
commented: Thanks for helping out with my problem +1
commented: Always very helpful :) +1

cool. tried using it for snake. works great! thanks

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.