LOGBOOK

HELP

Quiz Entry - updated: 2026.10.30

What scalar values, null values and comments can you write in YAML?

Comments start with #. Scalars are strings (plain, 'single' or "double" quoted), numbers (42, 3.14, -7) and booleans (true, false). Null is written null or ~.

# a comment runs to the end of the line
'A single-quoted string'
"A double-quoted string"
42
3.14
-7
true
false
null
~

A scalar is a single value, as opposed to a collection. YAML infers the type from how the value looks, which is convenient but has traps:

  • version: 1.10 becomes the number 1.1. Quote it ("1.10") if it is really a string.
  • In older YAML (1.1, which Ansible's parser still partly follows) words like yes, no, on, off are booleans too. That is why become: yes works, but also why a country code NO can turn into false. Prefer true/false and quote ambiguous strings.
  • Double quotes allow escape sequences such as \n; single quotes take the text literally.
  • A value that starts with {{ }} (a Jinja2 variable) must be quoted, or YAML reads it as an object.

Go deeper:

From Quiz: ITIA / Ansible Inventory, Configuration and Playbooks | Updated: Oct 30, 2026