Files
modeling-app/docs/kcl-std/push.md
Nick Cameron 1841e63021 Misc docs polishing (#6712)
* Fake modules for Rust std lib functions

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

* Include the missing @ in Rust std lib fns

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

* Move revolve and mirror2d to better modules

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

* Use docs from KCL mods for type summaries

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

* Use type docs to describe types from KCL std lib

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

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-05-06 16:09:59 +12:00

26 KiB

title, excerpt, layout
title excerpt layout
std::array::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: [any],
  item: any,
): any

Arguments

Name Type Description Required
array [any] The array which you're adding a new item to. Yes
item any The new item to add to the array Yes

Returns

any - Any KCL value.

Examples

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

Rendered example of std::array::push 0