send (Function)

Signature: send(channel: Channel<t0>, value: t0) -> Unit

Description: Blocks while the channel is full, then sends a value and returns Unit.

Parameters

  • channel (Channel<t0>): The channel to send to
  • value (t0): The value to send

Returns: Unit

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)