How it works...

The Processor() function in this recipe is a function that loops forever until its context is canceled, either through explicit calls to cancel or via timeout. It dispatches all work to Process(), which can handle different functions when given various operations. It would also be possible to have each of these cases dispatch another function for even more modular code.

Ultimately, the response is returned to a response channel, and we loop over and print all the results at the very end. We also demonstrate an error case in the divide by 0 example.