We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2290c79 commit 5f69fb6Copy full SHA for 5f69fb6
docs/tutorials/programming-language/main/02-00-basics/02-04-data-types.md
@@ -169,6 +169,14 @@ int[] a = new int[10];
169
int[] b = { 2, 4, 6, 8 };
170
```
171
172
+By default, the type of the array length is `int`, but a different type
173
+can be specified. For example, `uint8[:size_t] data` declares an array
174
+whose indices are `size_t`, which can therefore store any number of
175
+bytes that can be addressed (an `int`-indexed array can only have up to
176
+2^32 elements). Conversely, `string[] list = new string[10:uint8]`
177
+declares an array whose indices are bytes, which might be useful to save
178
+memory when many small array indices are stored.
179
+
180
You can slice an array with `[start:end]`:
181
182
```vala
0 commit comments