YAML Flashcards

1
Q

Describe the following YAML syntax:

- Apple
- Orange
- Strawberry
- Mango
A

This is a YAML list.

All members of a list are lines beginning at the same indentation level starting with a “- “ (a dash and a space)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Describe the following YAML syntax:

martin:
  name: Martin D'vloper
  job: Developer
  skill: Elite
A

This is a basic YAML dictionary.

A dictionary is represented in a simple ‘key: value’ form (the colon must be followed by a space)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Describe the following YAML syntax:

- martin:
    name: Martin D'vloper
    job: Developer
    skills:
      - python
      - perl
      - pascal
- tabitha:
    name: Tabitha Bitumen
    job: Developer
    skills:
      - lisp
      - fortran
      - erlang
A

This is a complex YAML structure featuring a list at the outermost level. Each list contains a dictionary. Inside those dictionaries, some of the values are lists.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Describe the following YAML syntax:

martin: {name: Martin D'vloper, job: Developer, skill: Elite}
fruits: ['Apple', 'Orange', 'Strawberry', 'Mango']
A

These are the abbreviated forms of YAML dictionaries and lists respectively.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Describe the following YAML syntax:

include_newlines: |
            exactly as you see
            will appear these three
            lines of poetry
A

The ‘|’ character in YAML is the Literal Block Scalar.

Values spanning multiple lines that begin with a ‘|’ will include any newlines and any trailing spaces.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Describe the following YAML syntax:

fold_newlines: >
            this is really a
            single line of text
            despite appearances
A

The ‘>’ character in YAML is known as the Folded Block Scalar.

This character will fold newlines to spaces; it is used to make what would otherwise be a very long line easier to read and edit.

“\n” escape sequences can be used in a folded block to enforce newlines to be included.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly