OnMouseDown toggle to show canvas

how to change OnMouseDown with toggle ? turn on/turn off that canvas with one MouseDown

using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class MouseDownText : MonoBehaviour {
	
public Canvas myCanvas;

void OnMouseUp()
{
	myCanvas.gameObject.SetActive(false);
}

void OnMouseDown()
{
	myCanvas.gameObject.SetActive(true);
}
}

just flip the boolean with it’s current state.

using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class MouseDownText : MonoBehaviour {

	public Canvas myCanvas;
	
	void OnMouseUp()
	{
		myCanvas.gameObject.SetActive(!myCanvas.gameObject.activeSelf);
	}

	void OnMouseDown()
	{
		myCanvas.gameObject.SetActive(!myCanvas.gameObject.activeSelf);
	}
}