Overview of advanced data types in YAML

Sequence (!!seq)

Sequence represents a collection indexed by sequential integers starting with zero as [0..n-1], where n is the number of items in the sequence.

It is specified by placing each member on a new line with a hyphen or dash character (-). See its usage in the example below.

Example

- red
- orange
- yellow

or

Example

# Ordered sequence of nodes
colors: !!seq
  - red
  - orange
  - yellow

There is also a compact notation using [] for sequence. The above sequence can also be represented as the example below:

Example

[red, orange, yellow]

The following is a graphical representation of the sequence in the code example:

Get hands-on with 1000+ tech skills courses.