Initializing a GameObject[] Array

I’m trying to acces to the variables inside of an Array that I’ve created:

[SerializeField] private GameObject[] _hitPoints;
    void Start()
    {
        foreach (GameObject value in _hitPoints)
        {
            print(value);
        }

        Debug.Log(_hitPoints.Pop());
    }

_hitPoints is: 200960-captura-de-pantalla-2022-10-20-104151.png

The foreach works perfectly, but in the line of _hitPoints.Pop() I keep getting an error which says:
GameObject[]’ does not contain a definition for ‘Pop’
I’ve read about giving arrays an initial value, but I would really love to have this array as dynamic so _hitPoints (a.k.a the hp of the player) could be bigger or smaller.
Thanks in advance

Well yes, an array has - as you apparently already know - a fixed size. The function “Pop” can be found in dynamic collections such as a Queue.

What you probably want to start with is a List like this:

  List<GameObject> _hitPoints = new List<GameObject>();

instead of GameObject[].

This way you can now use all the functions listed HERE.
This allows you to change the size of the list during runtime and add/remove elements.