is it possible to end actions that are happening? example:

repeat
writeln('example');
until c=1;      {the c is an example. im asking if it would be possible to change c to something like 'until readkey'}

readkey doesnt work. i hope you can understand what im tring to ask here. like the loop will keep on going unless a key is pressed or enter or something.

Of course can break,there are many condition...you are the programmer and you have to decide the condition...
See my example...:)

Program RepeatUntilBreaking;
Uses Crt;
Var  c:Char;{from ascii}
Begin {main}
     ClrScr;
     c:=#0;{initially}
     {#27=Esc button from keyboard}
     Repeat
     c:=ReadKey;
     {while you do not press the esc button
     the loop is continue}
     Until c=#27;  {and break when you press that esc button}
     Write('You pressed the esc...');
     ReadLn;
End. {main}
(*Created By FlamingClaw 2009.03.14*)

i mean like this:

repeat                                           
for row := 1 to 50 do
        for column := 1 to 50 do
                product[row,column] := row * column;
                writeln;

for row:= 1 to 50 do begin
        for column:= 1 to 50 do
                write(product[row,column]:3);
                end;
until cancel=#27;

the numbers keep on going. its like the matrix. but i want to end it by getting the user to press a button but the numbers just keep on going. i dont mean just a loop. i also mean actions that are currently happening like above. it is writing lots of numbers and when i pressed escape it didnt work.

After the 'repeat' write 'cancel:=Readkey'

Repeat
cancel:=ReadKey;
{...}
{your codes here...}
{...}
Until cancel=#27;

I say do not write infinite loops
:(

I have an other example,just see it :)

Program interruptingLoop;

Uses Crt;

Var c:Char;

Begin {main}
     ClrScr;

     Repeat
        Write('*');
     Until  KeyPressed; {see my note}

     c:=ReadKey;

     Write(c,' was pressed');

     ReadKey;
End. {main}

{
Note by FlamingClaw
The 'KeyPressed' function is a part of the 'Crt'  unit,that we
can use to checking if any key pressed or not..
The 'KeyPressed' command is returns a Boolean value:True or False.
If any key pressed while the  loop is run then KeyPressed:=True;
else KeyPressed:=False;
}
(*Created By FlamingClaw 2009.03.15*)
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.