show/hide GUI.box with a GUI.button

I did some research but couldn’t seem to find anything significant.
Here’s what I have so far:

var showInventory = false;

function OnGUI () {
    if(GUI.Button(Rect(210,80,35,30), "Open")){
    showInventory = true;
    }
    if (showInventory) {
    GUI.Box(Rect (10,50,315,300), "Inventory"); // x, y, w, h
    }
}

When the user clicks the GUI.Button, the GUI.Box should popup, when he clicks it again, it should disappear and etc… (a toggle button basically).

Change line 5 to:

showInventory = !showInventory;