Пример #1
0
    static void fibonacci(channel <int> c, channel <int> quit)
    {
        int x = 0, y = 1;

        while (true)
        {
            if (c.Sent(x))
            {
                var _y1 = x + y;
                x = y;
                y = _y1;
            }
            else if (quit.Received(out _))
            {
                fmt.Println("quit");
                return;
            }
        }
    }