> On Oct 8, 2020, at 5:14 AM, gabor via fpc-pascal 
> <fpc-pascal@lists.freepascal.org> wrote:
> 
> 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');

I never understood why we can't initialize fields at init time for records. 
Pascal seems to be the only language that doesn't support this in 2020. 
Thinking of C++, C#, PHP, Swift and many more all let you do this. Not even 
Delphi supports this AKAIK.

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


Regards,
        Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to