Problem
Write a program to make our producer fast and our receiver slow with unlimited capacity. The channel should accept all the elements and then let them be received one after another.
Restriction
The output will be available in the terminal.
Output
The output will be as follows; here, we will see a delay of 0.2 seconds after every sent statement and 1 second of delay after every receiving statement. This will be repeated three times. After sending it to the channel, we will see a delay of 0.6 seconds .
Sent to channel
Sent to channel
Sent to channel
Received = 0
Received = 2
Received = 4
Get hands-on with 1400+ tech skills courses.