Recent

Author Topic: [SOLVED] Static variable in the function  (Read 2184 times)

julkas

  • Guest
[SOLVED] Static variable in the function
« on: October 10, 2019, 05:59:58 pm »
How implement C like static variable in the function in FPC 3.0.4. ?
« Last Edit: October 10, 2019, 07:41:07 pm by julkas »

Cyrax

  • Hero Member
  • *****
  • Posts: 836
Re: Static variable in the function
« Reply #1 on: October 10, 2019, 06:18:54 pm »
Code: Pascal  [Select][+][-]
  1. procedure Static;
  2. const
  3.   StaticVariable : Integer = 0;
  4. begin
  5. end;

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: Static variable in the function
« Reply #2 on: October 10, 2019, 06:30:32 pm »
Maybe to be sure:
Code: Pascal  [Select][+][-]
  1. procedure Static;
  2. {$push} {$J+}
  3. const
  4.   StaticVariable : Integer = 0;
  5. {$pop}
  6. begin
  7. end;
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

julkas

  • Guest
Re: Static variable in the function
« Reply #3 on: October 10, 2019, 07:39:54 pm »
Thanks all. Working.

 

TinyPortal © 2005-2018