Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In YAML, you can assign an alias to anchor alternatives by using the ampersand (&) character to create an anchor for the alternative, and then using the asterisk (*) character to refer to the anchor with an alias. Here is an example:

# Define a sequence of alternatives
my_sequence:
  - &first_option This is the first option
  - &second_option This is the second option

# Create an alias for the first option
my_alias: *first_option

# Use the second option directly
another_option: *second_option

In this example, my_sequence contains two alternatives, each anchored with an identifier. my_alias is then created as an alias for the first alternative using the * syntax, and another_option is defined directly as an alias for the second alternative.