GUI button

Hello
I created GUI button with a bool variable
I programmed that when I click the button the bool var
will be true,but the problem is that the var is true all the time after I clicked
how can I do that the var will be true just when the button is down?
and when I release the button the var will be false
thx for all the helpers:p

if(Input.GetMouseButtonDown(0))
{
var=true;
}

if(Input.GetMouseButtonUp(0))
{
var=false;
}

HI
thx for the help
I wrote this code:

[RequireComponent(typeof(AudioSource))]

public class OptionsMenu : MonoBehaviour 
{
	public float vol;
	
	public bool but1 = false;
	public bool but2 = false;
	
	void Update () 
	{
		if(but1 == true)
		{
			vol = vol + 0.1f;
		}
		if(but2 == true)
		{
			vol = vol - 0.1f;
		}
	}
	
	void OnGUI()
	{
		if(GUI.Button(new Rect(Screen.width/2 + 50,Screen.height/2 - 100,50,50),"+")==true)
		{
			if(Input.GetMouseButtonDown(0))
			{
				but1 = true;
			}
			if(Input.GetMouseButtonUp(0))
			{
				but1 = false;
			}
		}
		
		if(GUI.Button(new Rect(Screen.width/2 - 75,Screen.height/2 - 100,50,50),"-")==true)
		{
			but2 = true;
		}
		
		GUI.Label(new Rect(Screen.width/2 - 20,Screen.height/2 - 90,100,100),"Volume:"+vol);
	}
}

for now its just on the plus button
did I wrote this right?
Im on the bus and cant try it

use this code

using UnityEngine;

using System.Collections;
public class TEST : MonoBehaviour  
{ 
    public float vol; 
     
    public bool but1 = false; 
    public bool but2 = false; 
     
    void Update ()  
    { 
        if(but1 == true) 
        { 
            vol = vol + 0.1f; 
        } 
        if(but2 == true) 
        { 
            vol = vol - 0.1f; 
        } 
		
	
            if(Input.GetMouseButtonUp(0)) 
            { 
                but1 = false; 
				
				but2=false;
            } 
		
    } 
     
    void OnGUI() 
    { 
        if(GUI.Button(new Rect(Screen.width/2 + 50,Screen.height/2 - 100,50,50),"+")==true)
        { 
           but1=true;
        } 
         
        if(GUI.Button(new Rect(Screen.width/2 - 75,Screen.height/2 - 100,50,50),"-")==true)
        { 
            but2 = true; 
        } 
         
        GUI.Label(new Rect(Screen.width/2 - 20,Screen.height/2 - 90,100,100),"Volume:"+vol);
    } 
}

thx for the help