Playing around with properties lazarus / 21-General ---------------------------------------------------------------------- JdeHaan · 2025-05-02 09:43 This is not a question. I just wanted to share this code, of which I wasn't aware that this was possible in FP. Especially, the way the record is created/initialized, using a property instead of a constructor. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program Project1;{$Mode Delphi} type  TTimesTable = record    private      fMultiplier: Integer;      function Init(Multiplier: Integer): TTimesTable;      function Multiply(Value: Integer): Integer;    public      property Multiplier: Integer read fMultiplier;      property Create[Multiplier: Integer]: TTimesTable read Init;      property Item[Value: Integer]: Integer read Multiply; default;  end;  { TTimesTable } function TTimesTable.Multiply(Value: Integer): Integer;begin  Result := Value * fMultiplier;end; function TTimesTable.Init(Multiplier: Integer): TTimesTable;begin  fMultiplier := Multiplier;  Result := Self;end; var  Table: TTimesTable;  n: Integer; begin  Table.Create[7];  WriteLn('Table of ', Table.Multiplier, ':');  for n := 1 to 10 do    WriteLn(n:2, ' x ', Table.Multiplier, ' = ', Table[n]:2);end. ---------------------------------------------------------------------- Thaddy · 2025-05-02 10:13 Two remarks: 1. It is a record 2. A property can be named as - almost - anything, you just happened to call it create. But yes, this is completely legal code.