user1365875
user1365875

Reputation: 149

E2033 Types of actual and formal var parameters must be identical

I have this line of code throwing up the above error:

server:=TIdHTTPServer.Create;
server.OnQuerySSLPort(8092,true);

I've read about using the right vars/constants but that doesn't seem to work.

Any help, appreciated

Upvotes: 1

Views: 2319

Answers (1)

Andreas Rejbrand
Andreas Rejbrand

Reputation: 108963

A var parameter is passed by reference (that is, the method doesn't want only a value, but a variable (which comes with a value), which it can alter if necessary), so you need to pass a variable (of the right type), not only a value. This works:

var
  mybool: boolean;
begin
  mybool := true;

  server := TIdHTTPServer.Create;
  server.OnQuerySSLPort(8092, mybool);
  // Now mybool can be either true or false; it's up to the method.

Upvotes: 4

Related Questions