From 5749add670f91dc3e6de10e24ca9a1b7d2181508 Mon Sep 17 00:00:00 2001 From: sudo-nice Date: Wed, 17 Jun 2020 13:03:09 +0300 Subject: [PATCH] doc: helping V to determine an array type --- doc/docs.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/docs.md b/doc/docs.md index 5fe6a76e66..e676caeda0 100644 --- a/doc/docs.md +++ b/doc/docs.md @@ -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`). -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. It can also append an entire array.