Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to express int array[6] in YAML

I have a type int arr[6], and the value is {1,2,3,4,5,6}. How should I express this data using YAML?

like image 885
pierrotlefou Avatar asked Nov 12 '09 12:11

pierrotlefou


People also ask

How do you represent an array in YAML?

The block sequence style of YAML uses hyphens or dashes to ( - ) to represent arrays. A hyphen ( - ) followed by white space ( ) represents an element of an array. When you enter the dashes, you need to ensure that all items are at the same indentation level.

Does YAML support arrays?

An array can contain any valid YAML value. The values in a list do not have to be the same type.

How do you write a key-value pair in YAML?

Key-Value Pairs. The YAML above defines four keys - first_name , last_name , age_years , and home - with their four respective values. Values can be character strings, numeric (integer, floating point, or scientfic representation), Boolean ( true or false ), or more complex nested types (see below).


2 Answers

[1, 2, 3, 4, 5, 6]

or

- 1
- 2
- 3
- 4
- 5
- 6
like image 105
Andrey Avatar answered Oct 05 '22 03:10

Andrey


You should simply use a list:

[1, 2, 3, 4, 5, 6]
like image 39
Joey Avatar answered Oct 05 '22 03:10

Joey