[fpc-pascal] does FPC support static variable inside a procedure ?

ik idokan at gmail.com
Thu Sep 27 17:10:12 CEST 2012


Hello,

Is there a way to create a static variable inside a procedure ?
The following code:

procedure static_variable;
var static_var : Integer = -1;
begin
  inc(static_var);
  writeln('static_var ', static_var);
end;

begin
  while true do
    begin
      static_variable;
      sleep(1000);
    end;
end.


Always print "0" as the answer.

Ido



More information about the fpc-pascal mailing list