Never used an animation script before, please help!

When i saved this script, unity is giving me errors to add a colon where the semicolon after the ("whatanimation") is. What im trying to do is have an door opener script, where another script has a false variable by default and is attacted to an invisible cube on the floor, but is set to true if the player runs over it. (DOORSWITCH) This script below is attached to the door with an animation made on maya. What am i doing wrong? And should i add an "= true" to after if(DoorOpen.DOORSWITCH) ? Thanks for you answers.

Script

var whatanimation : Animation;

function Update () 
{
  if(DoorOpen.DOORSWITCH);
  {
    animation.Play ("whatanimation");
  }
}

Remove the ';' in the 'DOORSWITCH' line, it does not belong there.

What that ; does is effectively ending the if-statement with an empty statement. So the {}-block that follows is no longer part of the if-statement. For some other reason, it appears that standalone blocks (=arbitrary code enclosed in {} ) are not allowed in JavaScript/UnityScript and are used for something else (which requires a ':').

You have a semi-colon after the closing bracket on DOORSWITCH);

This compiles properly if that was your only problem:

var whatanimation : Animation;

function Update () 
{
  if(DoorOpen.DOORSWITCH)
  {
    animation.Play ("whatanimation");
  }
}