Why does this immediately freeze the simulation?

This is my first time using this site. I apologize in advance.

I have tried to write this with for loops as well. In all cases I am able to comment either 1 of the loops successfuly; each individual loop works.

void Start()
	{
		
		terrainGuideMesh = GameObject.FindWithTag("TerrainGuide").GetComponent<MeshFilter>().mesh;
		terrainGuideBounds = terrainGuideMesh.bounds; 
		xTileExt=Mathf.RoundToInt(terrainGuideBounds.extents.x/0.1f);
		zTileExt=Mathf.RoundToInt(terrainGuideBounds.extents.z/0.1f);
		xTileCount=xTileExt*2;
		zTileCount=zTileExt*2;
		elevTable= new int[xTileCount,zTileCount];
	
		j=0;	
		while(j<xTileCount)
		{
			k=0;
			while(k<zTileCount)
			{
				elevTable[j,k]=1;
				print((j+1)+" at ("+j+","+k+")");
				k++;
			}
			j++;
		}
	}

If you’re doing this in C# then you shouldn’t use a while loop outside of a Coroutine. Try:

void Start()
{
    StartCoroutine(BuildTerrain());
}

IEnumerator BuildTerrain()
    {
       terrainGuideMesh = GameObject.FindWithTag("TerrainGuide").GetComponent<MeshFilter>().mesh;
       terrainGuideBounds = terrainGuideMesh.bounds; 
       xTileExt=Mathf.RoundToInt(terrainGuideBounds.extents.x/0.1f);
       zTileExt=Mathf.RoundToInt(terrainGuideBounds.extents.z/0.1f);
       xTileCount=xTileExt*2;
       zTileCount=zTileExt*2;
       elevTable= new int[xTileCount,zTileCount];

       j=0;  
       while(j<xTileCount)
       {
         k=0;
         while(k<zTileCount)
         {
          elevTable[j,k]=1;
          print((j+1)+" at ("+j+","+k+")");
          k++;
          yield return 0;
         }
         j++;
       }
    }