Hi, this is the first time i have ever used Delphi and was wondering if you could help me;
i understand how to writeln etc. but I'm having trouble with programs such as making a program that requires the user to write a message, and how many times they would like it to be displayed, and then display it x amount of times. I am clear on how to readln(x) etc. but have no idea how to output a varied amount of times?
thanks ,
Steven.

Recommended Answers

All 2 Replies

Loops?
while.. do begin.. end ; or repeat...until....; or for x:=1 to y do begin...end;

program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var num,i:byte;

begin
  write('Give me a number: ');
  readln(num);
  if num<=0 then begin
    writeln('Give me a number between 1 and 255');
    readln;
    halt;
  end;
  for i:=1 to num do begin
    writeln(i,'. message.');
  end;
  readln;
end.
(*by FlamingClaw 2010.02.21.Hungary*)

Hi, this is the first time i have ever used Delphi and was wondering if you could help me;
i understand how to writeln etc. but I'm having trouble with programs such as making a program that requires the user to write a message, and how many times they would like it to be displayed, and then display it x amount of times. I am clear on how to readln(x) etc. but have no idea how to output a varied amount of times?
thanks ,
Steven.

Are you talking about having the user dynamically write a message.
what is it you are trying to do exactly..
be more specific

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.