Skip to content

Commit 1098221

Browse files
Update KCL docs (#555)
YOYO NEW KCL DOCS!! Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent af276e9 commit 1098221

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

content/pages/docs/kcl-lang/arrays.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,16 @@ There are some useful functions for working with arrays in the standard library,
1616

1717
Arrays have their own types: `[T]` where `T` is the type of the elements of the array, for example, `[string]` means an array of `string`s and `[any]` means an array of any values.
1818

19-
Array types can also include length information: `[T; n]` denotes an array of length `n` (where `n` is a number literal) and `[T; 1+]` denotes an array whose length is at least one (i.e., a non-empty array). E.g., `[string; 1+]` and `[number(mm); 3]` are valid array types.
19+
Array types can also include length information: `[T; n]` denotes an array of length `n` (where `n` is a number literal) and `[T; n+]` denotes an array whose length is at least `n`. The common case for that is `[T; 1+]`, i.e., a non-empty array. E.g., `[string; 1+]` and `[number(mm); 3]` are valid array types.
2020

2121
## Ranges
2222

23-
Ranges are a succinct way to create an array of sequential numbers. The syntax is `[start .. end]` where `start` and `end` evaluate to whole numbers (integers). Ranges are inclusive of the start and end. The end must be greater than the start. Examples:
23+
Ranges are a succinct way to create an array of sequential numbers. The syntax is `[start .. end]` where `start` and `end` evaluate to whole numbers (integers). Ranges are inclusive of the start and end. The end must be greater than the start. A range which is exclusive of its end is written with `<end`. Examples:
2424

2525
```kcl,norun
2626
[0..3] // [0, 1, 2, 3]
2727
[3..10] // [3, 4, 5, 6, 7, 8, 9, 10]
28+
[3..<10] // [3, 4, 5, 6, 7, 8, 9]
2829
x = 2
2930
[x..x+1] // [2, 3]
3031
```

0 commit comments

Comments
 (0)