Dear Sir,

It is a simple example using a string.

program dowhile;
{$APPTYPE CONSOLE}

uses SysUtils, OurCrt;
var
   my_words : string;

begin
     my_words := '';
     writeln('Enter some words (type "stop" to finish):');
     readln(my_words);

     while (my_words <> 'stop') do
     begin
          clrscr;
          Writeln('You typed:');
          writeln(my_words);
          writeln;
          writeln('Enter some words (type "stop" to finish):');
          readln(my_words);
     end;

     writeln;
     writeln('This program has finished now');
end

But it does not work. Could you tell me what's wrong of it?

I don't know where is the problem,this program working well
put a dot to the end of the main program,and stop the program with rhe ReadLn; command

writeln;
writeln('This program has finished now');
ReadLn;
end.

While compiling I got an error on ourCrt.
Try this:

program dowhile;
{$APPTYPE CONSOLE}

uses SysUtils, Crt;
var
   my_words : string;

begin
     my_words := '';
     writeln('Enter some words (type "stop" to finish):');
     readln(my_words);

     while (my_words <> 'stop') do
     begin
          ClrScr;
          Writeln('You typed:');
          writeln(my_words);
          writeln;
          writeln('Enter some words (type "stop" to finish):');
          readln(my_words);
     end;

     writeln;
     writeln('This program has finished now');
end.
This question has already been answered. Start a new discussion instead.