# Keep Last X Elements In Array

The "Keep Last X Elements In Array" block in GraphLinq IDE is crucial for maintaining only the most recent elements in an array.

### Block Description

Part of the Array category, this block is designed to trim an array to a specified size, keeping only the most recent elements.

### Input Parameters

* Array (List): The array to be trimmed.

  Output This block does not have a direct output but modifies the input array to keep only the last specified number of elements.

  Example Use Case In a real-time weather monitoring graph, the "Keep Last X Elements In Array" block can be used to maintain only the most recent temperature readings, discarding older data.
* Amount To Keep (int): The number of elements to retain in the array.

### Output

This block does not have a direct output but modifies the input array to keep only the last specified number of elements.

### Example Use Case

In a real-time weather monitoring graph, the "Keep Last X Elements In Array" block can be used to maintain only the most recent temperature readings, discarding older data.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.graphlinq.io/dev-tooling/blocks/array/keep-last-x-elements-in-array.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
