BCE0044: expecting (, found 'OnTriggerEnter'.

Okay I’m working on a script that turns a light on if you are standing on a cube, if you step off the light turns off. If NOLon > NOL than the light should just turn on (please note NOL and NOLon are changed in other scripts). I am getting a strange error, help.
This is the error:
Assets/FinishLevel.js(10,18): BCE0044: expecting (, found ‘OnTriggerEnter’.

    var lightObject : Light;
    static var NOL = 1;
    static var NOLon = 0;
    while(NOL > NOLon){
    	lightObject.enabled = false; 
    	function OnTriggerEnter () {
    	    lightObject.enabled = true;

I looked this up in answers and usually I found that the person was defining a function within a function. Am I doing that? Oh, and I am currently working on a tutorial, so don’t tell me to go back to tutorials. I just want a quick answer to what this error means.

  1. You cant just use while statements outside of a function.
  2. Your function definition is inside of other statements.

Basically, except the variable definitions (which also contains dangerous static variables) there is nothing right about this code.