recv (Function)

Signature: recv(channel: Channel<t0>) -> t0

Description: Blocks while the channel is empty, then receives its oldest value.

Parameters

  • channel (Channel<t0>): The channel to receive from

Returns: t0

Example

fn receive(channel) = recv(channel)
let channel = Channel(1)
let worker = spawn receive(channel)
send(channel, 42)
print(await(worker))
receive channel = recv channel
channel = Channel 1
worker = spawn receive channel
send channel 42
print (await worker)