Pascal语法中记录常量声明

Pascal语法中记录常量声明

type
  TMyRec = record
    Val1: integer;
  end;  

  TRec2 = record
    Val1: integer;
    Val2: integer;
  end;
 
  TRec3 = record
    Val1: integer;
    Val2: string;
  end;
  
const
  CMyRec: TMyRec = (Val1: 10);               //记录型常量const
  CRec2: TRec2 = ( Val1: 10; Val2: 12; );    //记录型常量  const
  CRec3: TRec3 = ( Val1: 10; Val2: 'string');//记录型常量const
  
  ElementsA1: array [1 .. 3] of single = (0.0, 1.0, 2.0);
  ElementsA2: array [1 .. 2] of TRec3 = (( Val1: 10; Val2: 'string1'),  ( Val1: 10; Val2: 'string2'));//记录型数组常量
posted @ 2024-07-10 16:35  海利鸟  阅读(5)  评论(0编辑  收藏  举报