With Statements

With can be used to temporarily introduce new members in the scope. It supports multiple with items seperated by a comma.

Each with item starts with an optional matching keyword, an identifier, an : Type (which is optional) and a := Value. What this does is temporarily bind the identifier to have the value of the expression.

with un := Users[0].Name do begin
  Console.WriteLine('First name: ' + un.First);
  Console.WriteLine('Last name: ' + un.Last);
  Console.WriteLine('Middle name: ' + un.Middle);
end;

If the matching keyword is used the value is checked for nil, if it's nil the body of the with is skipped.

records

When the right side of a with item is a record, any changes done on the identifier will directly affect the original record.