user225626
user225626

Reputation: 1099

Conditional loop

        static bool BoxDiscovery(h) {
            ...
            //I've acquired bmp by this point in the ellipses above 

            for (int v = 211; v < 661; v++) {
                Color c = bmp.GetPixel(h, v);
                if (c.R > 221 && c.G < 153)
                //if c.r > 221 && c.G < 153 get me out of this crazy
                //  thing Jane and return true, else false without the
                //  compiler throwing an 'Unreachable code detected'. 
                //  Use break or anything you want.
                ...
                }
            }
        }

I'm feeling especially stupid today.

Upvotes: 0

Views: 230

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038720

static bool BoxDiscovery(h) 
{
    for (int v = 211; v < 661; v++) 
    {
        Color c = bmp.GetPixel(h, v);
        if (c.R > 221 && c.G < 153)
        {
            return true;
        }
    }
    // Make sure you provide a default value here
    // If we reach this point your condition hasn't been 
    // satisfied meaning that no box has been found
    // so you can safely return false
    return false;
}

Upvotes: 5

Related Questions