Subscript Method Example

The following program code demonstrates how to get the subscript of an item in a TMult variable:

procedure TForm1.Button1Click(Sender: TObject);
var
  Mult: TMult;
begin
  Mult := TMult.Create(Form1); {Create Mult. Make Form1 its owner}
  Label1.Caption := 'The subscript of the item at position 1 is ' +
     Mult.Subscript(1);        {will be empty since the list is empty}
  Mult['Second'] := 'Two';
  Label1.Caption := 'The subscript of the item at position 1 is ' +
     Mult.Subscript(1);        {will be empty. Only one item in list so far at 0th position}
  Mult['Third'] := 'Three';
  Label1.Caption := 'The subscript of the item at position 1 is ' +
     Mult.Subscript(1);        {will be Third}
end;