Making Lists
- How the dash ( - ) creates a list of items
- Simple lists vs. lists-of-groups (objects in lists)
- How to put lists inside nested groups and vice versa
Great job! You have learned how to organize information into groups with indentation. Now we will learn how to list many similar items — like a bullet-point list in a document.
Simple lists
Sometimes you need to list multiple things. In YAML, you use a dash (-) to make lists.
Click Next to see each item being added to the list:
Interactive: Making a List
Click Next to see how dashes create a list — like writing bullet points
This is like making a bullet-point list in a document. Each dash is one bullet point.
Lists inside nested groups
A list can live inside a nested group. The dashes are indented under their parent, just like any other child:
Here test_list is a child of chip_tests (2 dots of indent). The list items are children of test_list (4 dots). The project_name key and the test_list are siblings — both at 2 dots.
Lists where each item has its own details
Sometimes each item in your list is not just one value — each item has its own details. For example, your chip needs to run different tests, and each test has a name, how long it takes, and whether it is important.
This is like having a to-do list where each item has its own details. Click Next to see how each dash starts a new item:
Interactive: Lists of Objects
Click Next — watch how dashes create separate "index cards," each with its own fields
The key rule: a new dash at the same indent level = a new item. No dash = still the same item.
Here is the book’s complete example with all four tests. Count the dots — the list items are at 4 spaces, their fields at 6 spaces:
This is like having a to-do list where each item has its own details.
The deep pattern: nested groups inside list items
Here is the most powerful combination. Each list item can have its own nested group inside it. For example, each test has a settings group with voltage and temperature:
Count the indentation levels:
- 0 dots:
project(root) - 2 dots:
name,tests(children of project) - 4 dots:
- name:(list items inside tests) - 6 dots:
settings,expected_result(fields of each test item) - 8 dots:
voltage,temperature(inside the settings group)
That is four levels deep: project → tests → item → settings → voltage. It looks complex, but every level follows the same rule: indent 2 more spaces = go one level deeper.
Common beginner questions
Key takeaways
- ✓ Lists use dashes:
- item— always put a space after the dash - ✓ Each dash at the same indent = one item in the list
- ✓ Lists with details: new dash = new item, no dash = same item
- ✓ Lists can live inside nested groups — indent the dashes
- ✓ Each list item can have its own nested groups inside it
- ✓ You can combine nesting and lists as deep as you need