OnCollisionEnter giving an error?

Hey, trying to use a basic on collision enter script to destroy a gameObject when it collides with the collider.

Here is the script;

void OnCollisionEnter(Collision collision) {

Destroy(gameObject);

}

The error is:
“Assets/RocketLauncher.cs(18,25): error CS1547: Keyword `void’ cannot be used in this context”

Coding in C#*

Ah! Nevermind, did a rookiemistake and didn’t look where the last functions “}” was so I was doing it inside void Update()

Sorry for wasting anyones time