How to use the select statement
version
1.0.0beta1
scope
Example.
This code is provided as example code for a user to base their code on.
description
How to use the select statement
A select statement waits for one of a set of inputs to become ready, performs the selected input and then executes a corresponding body of code. Each input is proceeded by the keyword case and its body must be terminated with a break or return statement. Case statements are not permitted to contain output operations.
In this example the select statement is used to wait for either an input on chnlend_a or an input on chnlend_b. When an input is received from either channel the value of the input is printed.
select { case chnlend_a :> chnl_input_a : printstr("Channel Input A Received "); printintln(chnl_input_a); break; case chnlend_b :> chnl_input_b : printstr("Channel Input B Received "); printintln(chnl_input_b); break; }