就是局部常量。example:
procedure test
const
  localvar: integer = 0;
begin
  //do what you want
  inc(localval); 
  //do what you want
end;

解决方案 »

  1.   

    用const的话好象要先看一下设置Options->Complier中把允许给常量值的那个打上勾
    缺省是有钩的其实Const和Static不是一回事,但在Delphi中是把const和static放到一起用If  那个钩钩没有
      Begin
        Delphi.Const = C.Const;
      End
      Else
      Begin
        Delphi.Const = VB.Static;
      End;
      

  2.   

    静态变量在 Pascal 中被称作“类型常量”,这是在标准 Pascal 语言中被定义的,所有的 Pascal 编译系统都应支持这个语法特性,声明如下:const
      MAX = 100;        // 普通常量,不可改变它的值  St: Integer = 20; // 类型常量,可以改变它的值,与 C 语言中的 static 修饰的静态变
                        // 量性质是一样的Turbo Pascal 中早就有这种语法现象了,在 Delphi 中当然更能使用!