Files
modeling-app/docs/kcl-std/pop.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

27 KiB

title, excerpt, layout
title excerpt layout
std::array::pop Remove the last element from an array. manual

Remove the last element from an array.

Returns a new array with the last element removed.

pop(@array: [any]): any

Arguments

Name Type Description Required
array [any] The array to pop from. Must not be empty. Yes

Returns

any - Any KCL value.

Examples

arr = [1, 2, 3, 4]
new_arr = pop(arr)
assert(
  new_arr[0],
  isEqualTo = 1,
  tolerance = 0.00001,
  error = "1 is the first element of the array",
)
assert(
  new_arr[1],
  isEqualTo = 2,
  tolerance = 0.00001,
  error = "2 is the second element of the array",
)
assert(
  new_arr[2],
  isEqualTo = 3,
  tolerance = 0.00001,
  error = "3 is the third element of the array",
)

Rendered example of std::array::pop 0