Fork me on GitHub

often instead of a dedicated stop chan it suffices to check if your input channel has been closed - that's a condition that you should handle with a graceful exit from the loop regardless

👍 5

(of course that doesn't apply when you don't have an input channel, but I find looping without an input chan or at least an output chan is rare -- output channels similarly should trigger exit of your loop if closed)