Config often has a list of like-shaped sections, such as several products. Today you parse an array of tables, a double-bracket header that appends a new table element each time it appears.
Parse [[name]] headers that append a table element per occurrence.
When a document has several sections of the same shape - a list of products,
servers, or fruits - TOML uses an array of tables, written with double brackets:
[[products]]. Each time that header appears, it appends a new table to the
array named products, and the pairs that follow fill in that newest element. So
two [[products]] headers produce a two-element array, each element the table its
following pairs describe.
This is the one header form that is not a redefinition when repeated - that is
its entire purpose. The first [[products]] creates the array and its first table;
the second finds the existing array and appends a second table, rather than
erroring. The current-table pointer moves to the freshly appended element, so
name = "A" after the first header and name = "B" after the second land in
different tables. This gives TOML its way of expressing ordered, repeated records
without any outer list syntax, and the next lesson lets those records hold subtables
of their own.
// a line [[ name ]] is an array-of-tables header:// find or create an array value at `name`// append a NEW empty table to it// set current = that new table// a second [[name]] appends another element (does not redefine)