On 25/12/11 10:07, Jiří Pavlovský wrote:

What do you mean ?
I mean the code below works ok, so I don't undestand why it doesn't
compile when I use similar construct inside a function.
const ranges: array [1..2] of TMyRec =
      (
          (Start:    0;    Stop:    3),
          (Start:    4;    Stop:    7)
        );

Are you looking for something like this? (BTW your code snippets are too short to really understand what you can't do).

type
  TMyRec = record
    Start, Stop: integer;
  end;

TRange = array [1..2] of TMyRec;

const RANGES: TRange =
     (
         (Start:    0;    Stop:    3),
         (Start:    4;    Stop:    7)
       );

function GetRec(anIndex: integer): TMyRec;
begin
  result := RANGES[anIndex];
end;
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to