* 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>
40 lines
26 KiB
Markdown
40 lines
26 KiB
Markdown
---
|
|
title: "pop"
|
|
excerpt: "Remove the last element from an array."
|
|
layout: manual
|
|
---
|
|
|
|
Remove the last element from an array.
|
|
|
|
Returns a new array with the last element removed.
|
|
|
|
```js
|
|
pop(array: [KclValue]): KclValue
|
|
```
|
|
|
|
|
|
### Arguments
|
|
|
|
| Name | Type | Description | Required |
|
|
|----------|------|-------------|----------|
|
|
| `array` | [`[KclValue]`](/docs/kcl/types/KclValue) | The array to pop from. Must not be empty. | Yes |
|
|
|
|
### Returns
|
|
|
|
[`KclValue`](/docs/kcl/types/KclValue) - Any KCL value.
|
|
|
|
|
|
### Examples
|
|
|
|
```js
|
|
arr = [1, 2, 3, 4]
|
|
new_arr = pop(arr)
|
|
assertEqual(new_arr[0], 1, 0.00001, "1 is the first element of the array")
|
|
assertEqual(new_arr[1], 2, 0.00001, "2 is the second element of the array")
|
|
assertEqual(new_arr[2], 3, 0.00001, "3 is the third element of the array")
|
|
```
|
|
|
|

|
|
|
|
|