doc: helping V to determine an array type

pull/5406/head
sudo-nice 2020-06-17 13:03:09 +03:00 committed by GitHub
parent fb5cae7376
commit 5749add670
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -425,7 +425,9 @@ The type of an array is determined by the first element: `[1, 2, 3]` is an array
`['a', 'b']` is an array of strings (`[]string`). `['a', 'b']` is an array of strings (`[]string`).
V arrays are homogenous (all elements must have the same type). This means that code like `[1, 'a']` will not compile. If V is unable to infer the type of an array, the user can explicitly specify it for the first element: `[byte(0x0E), 0x1F, 0xBA, 0x0E]`
V arrays are homogeneous (all elements must have the same type). This means that code like `[1, 'a']` will not compile.
`<<` is an operator that appends a value to the end of the array. `<<` is an operator that appends a value to the end of the array.
It can also append an entire array. It can also append an entire array.