OK,
is it possible to define the TMyRecord with default values so that
when I do Default(TMyRecord) it will be non-zero defaults written
instead of zeros?

You can define typed constant and assign it to variable.

type
  TMyRecord = record
    X, Y: Integer;
    S: String;
  end;

const
  MYDEFREC: TMyRecord = (X: 1; Y: 2; S: 'ABC');

var
  R: TMyRecord;

begin
  R := MYDEFREC;
end.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to