A namespace cannot directly contain members such as fields or methods

Doing a tutorial for creating a game. Very early in and learning about loops. When I try to compile this code, I get an error. I looked at some previous resolutions for this issue and all I saw was that there needed to be a monobehaviour attached and I already have that. Also the file is saved as Player.cs, so unity should be reading it correctly. What do I need to do to make this code compile?

Unity is telling me it’s line 24. That is were ‘Void update()’ is.

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

public class Player : MonoBehaviour
{

// Start is called before the first frame update
void Start()
{
for (int year = 1991; year <= 2000; year++)

{
UnityEngine.Debug.Log(year);
}

}
}

// Update is called once per frame
void Update()
{

}

The Update method is outside of your Player class.

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

public class Player : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
for (int year = 1991; year <= 2000; year++)
{
UnityEngine.Debug.Log(year);
}
}

// Update is called once per frame
void Update()
{

}
}