2
test: Simple Inline Array
4
Sequences can be contained on a
5
single line, using the inline syntax.
6
Separate each entry with commas and
7
enclose in square brackets.
11
array('seq' => array('a', 'b', 'c'))
13
test: Simple Inline Hash
15
Mapping can also be contained on
16
a single line, using the inline
17
syntax. Each key-value pair is
18
separated by a colon, with a comma
19
between each entry in the mapping.
20
Enclose with curly braces.
22
hash: { name: Steve, foo: bar }
24
array('hash' => array('name' => 'Steve', 'foo' => 'bar'))
26
test: Multi-line Inline Collections
29
Both inline sequences and inline mappings
30
can span multiple lines, provided that you
31
indent the additional lines.
36
websites: { YAML: yaml.org,
42
'languages' => array('Ruby', 'Perl', 'Python'),
45
'Ruby' => 'ruby-lang.org',
46
'Python' => 'python.org',
47
'Perl' => 'use.perl.org'
51
test: Commas in Values (not in the spec!)
54
List items in collections are delimited by commas, but
55
there must be a space after each comma. This allows you
56
to add numbers without quoting.
58
attendances: [ 45,123, 70,000, 17,222 ]
60
array('attendances' => array(45123, 70000, 17222))