diff --git a/README.md b/README.md index 6700b95b..5eb1306b 100644 --- a/README.md +++ b/README.md @@ -579,30 +579,34 @@ Array ----- Arrays are square brackets with values inside. Whitespace is ignored. Elements -are separated by commas. Data types may not be mixed (different ways to define -strings should be considered the same type, and so should arrays with different -element types). +are separated by commas. Arrays can contain values of the same data types as +allowed in key/value pairs. Values of different types may be mixed. ```toml -arr1 = [ 1, 2, 3 ] -arr2 = [ "red", "yellow", "green" ] -arr3 = [ [ 1, 2 ], [3, 4, 5] ] -arr4 = [ "all", 'strings', """are the same""", '''type'''] -arr5 = [ [ 1, 2 ], ["a", "b", "c"] ] +integers = [ 1, 2, 3 ] +colors = [ "red", "yellow", "green" ] +nested_array_of_int = [ [ 1, 2 ], [3, 4, 5] ] +nested_mixed_array = [ [ 1, 2 ], ["a", "b", "c"] ] +string_array = [ "all", 'strings', """are the same""", '''type''' ] -arr6 = [ 1, 2.0 ] # INVALID +# Mixed-type arrays are allowed +numbers = [ 0.1, 0.2, 0.5, 1, 2, 5 ] +contributors = [ + "Foo Bar ", + { name = "Baz Qux", email = "bazqux@example.com", url = "https://example.com/bazqux" } +] ``` -Arrays can also be multiline. A terminating comma (also called trailing comma) +Arrays can span multiple lines. A terminating comma (also called trailing comma) is ok after the last value of the array. There can be an arbitrary number of newlines and comments before a value and before the closing bracket. ```toml -arr7 = [ +integers2 = [ 1, 2, 3 ] -arr8 = [ +integers3 = [ 1, 2, # this is ok ]