You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
:number -> match {
0: zero_string // node that sends string
1: one_string // another node that sends string
...
_: unknown_string // and one more string node
} -> :string
One might think that dictionary data type can handle this use-case. That's not entirely true because dictionary can't have network senders as keys and values
With Multiple Conditions On a Same Branch
Similar to if, match supports multiple condition senders on a single branch. Each condition sender is compared to the incoming data message in sequence before moving to the next branch. And of course it supports multiple receivers as a fan-out.
Previous parts:
if
#802switch
#804Match
Basic
Match is a selector. It selects a message to send, but not the direction, so it has only one output port connected to its body.
Example
With Multiple Conditions On a Same Branch
Similar to
if
,match
supports multiple condition senders on a single branch. Each condition sender is compared to the incoming data message in sequence before moving to the next branch. And of course it supports multiple receivers as a fan-out.Example
As a Ternary
In the same way that
switch
can emulateif
,match
can emulate the ternary operator.The ternary expression should be preferred whenever possible.
The text was updated successfully, but these errors were encountered: