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?
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.
An array can contain any valid YAML value. The values in a list do not have to be the same type.
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).
[1, 2, 3, 4, 5, 6]
or
- 1 - 2 - 3 - 4 - 5 - 6
You should simply use a list:
[1, 2, 3, 4, 5, 6]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With