Results 1 to 4 of 4

Thread: help needed : Typed CONSTANTs

  1. #1

    Post help needed : Typed CONSTANTs

    My question is, how can i set up a constant of a special type with several values ?

    <code>
    TYPE
    TDesc = record
    a,b,c : dword;
    end;

    // typed constant declaration identifier : type = typed constant
    CONST
    abc : TDesc = ( a:dword=10
    b:dword=11,
    c:dword=12 );
    </code>

  2. #2
    PGD Community Manager AthenaOfDelphi's Avatar
    Join Date
    Dec 2004
    Location
    South Wales, UK
    Posts
    1,246
    Blog Entries
    2
    Do something like this:-

    Code:
    Type
      TMyType = record
        name: string;
        data1: integer;
        data2: string;
      end;
    
    Const
      MY_DATA : array[0..1] of TMyType = (
        (name:'Fred'; data1:10; data2:'Favourite colour'),
        (name:'Borris';  data1:16; data2:'Mother''s maiden name')
      );
    :: AthenaOfDelphi :: My Blog :: My Software ::

  3. #3

  4. #4
    Hi,

    After all this time using Pascal, I have never created a constant array or a constant array of records Mini Militia App Lock 7Zip. Its good to know that PAscal offers this syntax, who knows ? May be I will need something like that in the near future.
    Last edited by NOUR; 18-01-2019 at 08:40 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •