A record represents a collection of values stored together as one, where each component is identified by a different field name. Note that record field names must start with a lowercase letter

type person = {
  name : string;
  age : int;
}

Record Field Punning

When the name of a variable coincides with the name of a record field, OCaml automatically binds the variable to the name.

val service_info_to_string : service_info -> string = <fun>
 
let service_info_to_string { service_name; port; protocol; comment } =
  let base = sprintf "%s %i/%s" service_name port protocol in
  match comment with
  | None -> base
  | Some text -> base ^ "#" ^ text