
Getting Started with V Programming
By :

V has a select
statement, which you can use to wait on multiple channels and their operations. A select statement can have multiple branches and cases, all of which can be used to represent channel push or pop operations. It can also have a timeout case, which we can define to exit out of select
if none of the channel operation cases get triggered.
The select
statement is syntactically similar to a match
block, except that the cases of a select
do not have to be of channels that accept similar data types. But for match
, as explained in Chapter 6, Conditionals and Iterative Statements, all the conditional branches need to be of similar data types.
The following are a few points to keep note of when working with select
statements:
select
statement randomly picks the cases that are ready to be executed.select
statement blocks other cases until the active case finishes and exits out of the case.select
statements can be of any...