Exit game when you crush into box collider?

Hi everyone!
Could anyone give me a code sample on how to exit a game when you crash into a box collider?
Tried to figure it out by my self, but with no luck, infortunatly.

What’s so hard about this?

void OnCollision(Collider other)
{
    if(other == endBox)
    {
        Application.Quit();
    }
}

Just assign ‘endBox’ in the inspector, a public Collider which you drag the box in question onto.