The name animator does not exist in the current context... Help?

Ok, so I have this code that’s setup to change the parameter in my animator controller from 0 to 1 when the W key is pushed down. This is the code I have:

using UnityEngine;
using System.Collections;

public class NewBehaviourScript : MonoBehaviour {

// Use this for initialization
void Start () {

	animator = GetComponent<Animator>();	
}

// Update is called once per frame
void Update () {
	if (Input.GetKeyDown(KeyCode.W))
	{ 
		animator.SetFloat ("Forward", 1);
	}
}

}

But the problem is that it has errors that say that the keyword animator isn’t recognized… Here’s an image to show exactly what I mean.

In your script add this line before the void Start:

Animator animator;