boolean is true and false at a same time

with no Additional Details , this is my code

void OnGUI()
{

        if (ShopGui) firstInv();
        if (secondGUI) secondInv();
      
      
    }
    void firstInv()
    {
        print(ShopGui);
        if(ShopGui)
        {
            GUI.BeginGroup(new Rect(0, 0, Screen.width, Screen.height), "");
            int i = 0;
            for (int X = 0; X < 3; X++)
            {
                for (int Y = 0; Y < 3; Y++)
                {
                    Rect slotRect = new Rect(X * ((Screen.width / 4) + 10), Y * ((Screen.width / 4) + 10), Screen.width / 4, Screen.width / 4);
                    if(GUI.Button(slotRect, ""))
                    {
                        Debug.Log("Clicked the button with an image");
                        ShopGui = false;
                        secondGUI = true;
                    }
                    
                    menuSecond _= menuFirst*;*_

GUI.DrawTexture(slotRect, menuSecond*.view);*
i++;

}

}
GUI.EndGroup();
}

}
void secondInv()
{
if(secondGUI)
{
if( GUI.Button(new Rect(50, 50, 100, 100), “SecondInv”))
{
ShopGui = true;
secondGUI = false;
}

}

}

but something strange happens , the 1st time i click on a gui .button both of my gui menus appear on screen and the shopgui boolan is both true and false…but the next times this problems goes away…
would anybody tell me why this happens

ok i think it was for changing monodevolop to VS in middle of way , i started with VS the same code and it works perfectly
thanks from your comments

What evidence did you have that the bool is both true and false? A bool cannot be both true and false. It can change between true and false.

The most likely problem was both bools were initialised as true. This would explain why the problem only occurred on the fist instance. I’m picking you fixed this without realising it when you rewrote the script.