Monodevelop files a compiler error when I try to make a variable,Monodevelop files complilerr error when I try to make a public variable

Here’s my Code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public float DeForce01 = 420f;

public class FloatBob : MonoBehaviour  {

	public Rigidbody rb;

	// Update is called once per frame
	void Update () {
		rb.AddForce (0,0, DeForce01 * Time.deltaTime );
	}
}

,Here’s my code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public float DeForce01 = 420f;

public class FloatBob : MonoBehaviour  {

	public Rigidbody rb;

	// Update is called once per frame
	void Update () {
		rb.AddForce (0,0, DeForce01 * Time.deltaTime );
	}
}

`

Someone Commented that I had to put my variable in the class. [face palm]