# sample

**不定期的对 `Observable` 取样**

![](/files/-MWlwP_risET1YVl1Kmd)

**sample** 操作符将不定期的对源 `Observable` 进行取样操作。通过第二个 `Observable` 来控制取样时机。一旦第二个 `Observable` 发出一个元素，就从源 `Observable` 中取出最后产生的元素。


---

# 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://3440217568.gitbook.io/rxswift/decision_tree/sample.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.
