[Solved] foreach loop write to console

Why does this not print the values in the list?

private int x;

    void Start()
    {
        x = Random.Range(5, 20);
        List<int> currentIntList = new List<int>();
        for (int i = 0; i < x; i++)
        {
            currentIntList.Add(Random.Range(0, 100));
        }

        foreach (int integers in currentIntList)
        {
            Console.WriteLine(integers);
        }
}

I have also tried currentIntList.ForEach(integer => Console.WriteLine(integer)); instead of the foreach.

I have tried using just print(currentIntList); this however gives an error when I run it.

for (int i = 0; i < currentIntList.Count; i++)
            Console.WriteLine(currentIntList*); //Also doesn't print anything.*

Here is the error I get:
System.Collections.Generic.List`1[System.Int32]
UnityEngine.MonoBehaviour:print(Object)
ListScript:Start() (at Assets/Scripts/ListScript.cs:22)
I don’t really know any other ways so help is appreciated

I tried some things
private int x;
List currentIntList = new List();

void Start()
{
x = Random.Range(5, 20);
print(x);
for (int i = 0; i < x; i++)
{
currentIntList.Add(Random.Range(0, 100));
Debug.Log(“Integer added to list”);
}

for (int i = 0; i < currentIntList.Count; i++)
Console.WriteLine(currentIntList*);*
}
So I can now see what x is in the console, and I can see how many times it is adding a random int to the list. which seems to only run once no matter what.
I’m not sure why it will only add one int. for x = 18 it runs just once, but shouldn’t it keep returning to see if i is less than x before it stops at i being larger than x?. I’m very confused

You should be using Debug.Log() for everything:

private int x;
     List<int> currentIntList = new List<int>();
 
     void Start()
     {
         x = Random.Range(5, 20);
         Debug.Log(x);
         for (int i = 0; i < x; i++)
         {
             currentIntList.Add(Random.Range(0, 100));
             Debug.Log("Integer added to list");
         }
 
         for (int i = 0; i < currentIntList.Count; i++)
             Debug.Log(currentIntList*);*

}