[Solved] Thread method skipping ‘if’ statement [closed]


I’m guessing this is what you want to do, but since you haven’t told us your goals we can only guess

public void DoWork()
{
    for(int i=2; i < variable/ 2; i++)
    {
        if (variable% i == 0) {
            label4.Text ="yes not";
            return;
        }
    }
    label4.Text = "yes";
}

I don’t use C# but if DoWork is how you create a Thread then I think it’s a bit much for something that should take almost no time at all to finish.

1

solved Thread method skipping ‘if’ statement [closed]