From b0f8acf30f72624dee66760c6445e128b2346607 Mon Sep 17 00:00:00 2001 From: sae220 Date: Tue, 8 Oct 2024 23:14:38 +0900 Subject: [PATCH] Revert remove-at-statement.md --- .../reference/arrays/remove-at-statement.md | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 common-docs/reference/arrays/remove-at-statement.md diff --git a/common-docs/reference/arrays/remove-at-statement.md b/common-docs/reference/arrays/remove-at-statement.md new file mode 100644 index 000000000000..559133a6fbd4 --- /dev/null +++ b/common-docs/reference/arrays/remove-at-statement.md @@ -0,0 +1,33 @@ +# remove At (no return value) + +Remove an element from an array at some position. + +```sig +[""]._removeAtStatement(0) +``` + +The size of the array shrinks by one. The element is removed from the array at the position you want. All the other elements after it are moved (shifted) to down to the next lower position. So, an array that has the numbers +`4, 5, 9, 3, 2` will be `4, 5, 3, 2` if `9` is removed from the array at index `2`. It looks like this in blocks: + +```block +let myNumbers = [4, 5, 9, 3, 2] +myNumbers.removeAt(2) +``` + +## Parameters + +* **index**: the position in the array to get the element from. + +## Example + +Remove the largest animal from the list of primates. + +```block +let primates = ["chimpanzee", "baboon", "gorilla", "macaque"] +let largest = primates.indexOf("gorilla") +primates.removeAt(largest) +``` + +## See also + +[remove at](/reference/arrays/remove-at), [insert at](/reference/arrays/insert-at) \ No newline at end of file