diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-08-18 23:31:36 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-08-18 23:31:36 -0400 |
| commit | 9e07c6adc7a0616eec40e78024a8501ec7d96559 (patch) | |
| tree | 92542ba27e13152a8305deb6f0cda3a952ac8835 /api/channels.md | |
| parent | 1f16d63ac783d9b1bb1d4a65676476d14f0af713 (diff) | |
Add Channel:peek()
Diffstat (limited to 'api/channels.md')
| -rw-r--r-- | api/channels.md | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/api/channels.md b/api/channels.md index dbb6707a..ca7ce17e 100644 --- a/api/channels.md +++ b/api/channels.md @@ -93,6 +93,32 @@ The item removed from the channel. **Example:** ```markdown +>> channel:peek() += "Hello" +``` + +--- + +### `peek` + +**Description:** +Returns the next item that will come out of the channel, but without removing +it. If the channel is empty, it waits until an item is available. + +**Usage:** +```markdown +peek(channel:|T|) -> T +``` + +**Parameters:** + +- `channel`: The channel from which to remove an item. + +**Returns:** +The item removed from the channel. + +**Example:** +```markdown >> channel:get() = "Hello" ``` |
