* Show more info on hover for variables Signed-off-by: Nick Cameron <nrc@ncameron.org> * Move hover impls to lsp module Signed-off-by: Nick Cameron <nrc@ncameron.org> * Make hover work on names inside calls, fix doc line breaking, trim docs in tool tips Signed-off-by: Nick Cameron <nrc@ncameron.org> * Test the new hovers; fix signature syntax Signed-off-by: Nick Cameron <nrc@ncameron.org> * Hover tips for kwargs Signed-off-by: Nick Cameron <nrc@ncameron.org> --------- Signed-off-by: Nick Cameron <nrc@ncameron.org>
42 lines
26 KiB
Markdown
42 lines
26 KiB
Markdown
---
|
|
title: "push"
|
|
excerpt: "Append an element to the end of an array."
|
|
layout: manual
|
|
---
|
|
|
|
Append an element to the end of an array.
|
|
|
|
Returns a new array with the element appended.
|
|
|
|
```js
|
|
push(
|
|
array: [KclValue],
|
|
elem: KclValue,
|
|
): KclValue
|
|
```
|
|
|
|
|
|
### Arguments
|
|
|
|
| Name | Type | Description | Required |
|
|
|----------|------|-------------|----------|
|
|
| `array` | [`[KclValue]`](/docs/kcl/types/KclValue) | | Yes |
|
|
| `elem` | [`KclValue`](/docs/kcl/types/KclValue) | Any KCL value. | Yes |
|
|
|
|
### Returns
|
|
|
|
[`KclValue`](/docs/kcl/types/KclValue) - Any KCL value.
|
|
|
|
|
|
### Examples
|
|
|
|
```js
|
|
arr = [1, 2, 3]
|
|
new_arr = push(arr, 4)
|
|
assertEqual(new_arr[3], 4, 0.00001, "4 was added to the end of the array")
|
|
```
|
|
|
|

|
|
|
|
|