how to detect mouse click on a gameobject with "gameobjectexample" name?

Sorry, I just downloaded Unity and started to learn C# code one week ago LoL
How can I write a code in C# that makes a task when I click on an object that have a certain name and makes another task when I click on an object with another given name?
I tried with this:

public void OnMouseOver()
{
if (Input.GetMouseButtonDown(0))
{
if (gameObject.name == “Yellow block”)
{
//do task 1;
}

        if (gameObject.name == "Red block")
        {
            //do task 2;
        }
    }
}

,

A quick google search leads to the answer on this page:

always search 1st, also should use tags instead of gameObject.name