Sobes.tech
Junior — Senior

Endless output of the final number from the channel

livecode

Task condition

There are three functions: Generate() — generates a sequence of numbers and sends them to a channel. readChan() — retrieves data from the channel and processes it. printer() — outputs the current value to the console. Problem: After all elements from the channel have been read and processed, the last value continues to be output infinitely. It is necessary to explain why this effect occurs and to suggest a fix.