Skip to content

Commit

Permalink
Update descriptions and code
Browse files Browse the repository at this point in the history
  • Loading branch information
poorna2152 committed Aug 21, 2024
1 parent 8d338ad commit a96fba2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions examples/multiple-receive/multiple_receive.bal
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import ballerina/io;
import ballerina/lang.runtime;

type Result record {
int w1;
int w2;
int a;
int b;
};

public function main() {
Expand All @@ -18,11 +18,10 @@ public function main() {

worker w3 returns Result {
// The worker waits until both values are received.
Result result = <- {w1, w2};
Result result = <- {a: w1, b: w2};
return result;
}

Result result = wait w3;
io:println(result.w1);
io:println(result.w2);
io:println(result);
}
2 changes: 1 addition & 1 deletion examples/multiple-receive/multiple_receive.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Multiple receive

The multiple receive action enables receiving messages from multiple workers, waiting until a message is available from each worker to construct a record with received values.
The multiple receive action can be used to receive values from multiple send actions. It operates by awaiting the receipt of values from all the send actions, subsequently constructing a map containing those values.

::: code multiple_receive.bal :::

Expand Down

0 comments on commit a96fba2

Please sign in to comment.