Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 475
  • Last Modified:

Delphi functions and procedures

Following is my first Delphi app simply to see Delphi console application structure. I want to write a console app that calls a procedure. The following program, the compiler can't see the pr procedure. I am getting undeclared identifier.

program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  str : String;
begin
  { TODO -oUser -cConsole Main : Insert code here }
  pr;
  Readln(str);
end.

procedure pr;
var i:int
begin
   Writeln('This is it!');
end;
0
yassin092898
Asked:
yassin092898
1 Solution
 
TheRealLokiSenior DeveloperCommented:
put the procedure above your main code

program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  str : String;

procedure pr;
var i:int
begin
   Writeln('This is it!');
end;

begin
  { TODO -oUser -cConsole Main : Insert code here }
  pr;
  Readln(str);
end.

0
 
Eddie ShipmanAll-around developerCommented:
You also have syntactical errors in your code:

The line:

var i:int

should be:

var i:integer;

But then you are not using this variable, why define it?

0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now