When using the select statement, you can combine read-write operations.
The code below declares two channels. Your task is to write the additional required code with three actions in the select statement:
-
Reading data from the
inputChanchannel. -
Writing data to the
outputChanchannel. -
Exiting the program if read-write operations are not possible.
You can write any number to outputChan. The data read from inputChan must be printed. Finally, print the message "exit" at the end of the program.
This problem uses the hidden
check() function to check your solution for this coding task.