Files
modeling-app/docs/kcl/push.md
Nick Cameron 1104d908c0 Improve hover tool tips and function docs (#5538)
* Improve hover tool tips and function docs

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-02-27 22:03:37 +13:00

26 KiB

title, excerpt, layout
title excerpt layout
push Append an element to the end of an array. manual

Append an element to the end of an array.

Returns a new array with the element appended.

push(
  array: [KclValue],
  elem: KclValue,
) -> KclValue

Arguments

Name Type Description Required
array [KclValue] Yes
elem KclValue Any KCL value. Yes

Returns

KclValue - Any KCL value.

Examples

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")

Rendered example of push 0