Make the function signature less prominent, add an early example to docs

Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
Nick Cameron
2025-06-19 17:08:46 +12:00
parent 6358eed7e4
commit ff1be99351
99 changed files with 2137 additions and 686 deletions

View File

@ -8,13 +8,16 @@ layout: manual
Append an element to the end of an array.
```kcl
push(
@array: [any],
item: any,
): [any; 1+]
```
arr = [1, 2, 3]
new_arr = push(arr, item = 4)
assert(
new_arr[3],
isEqualTo = 4,
tolerance = 0.1,
error = "4 was added to the end of the array",
)
Returns a new array with the element appended.
```
### Arguments
@ -27,6 +30,18 @@ Returns a new array with the element appended.
[`[any; 1+]`](/docs/kcl-std/types/std-types-any)
### Description
Returns a new array with the element appended.
### Function signature
```kcl
push(
@array: [any],
item: any,
): [any; 1+]
```
### Examples