c# – ‘PerlinNoise.GenerateHeights()’: not all code paths return a value

i got an error

Assets/PerlinNoise.cs(26,14): error CS0161: ‘PerlinNoise.GenerateHeights()’: not all code paths return a value

i don’t know what might happened, i’m new in C#, my code is:

using UnityEngine;

public class PerlinNoise : MonoBehaviour
{

    public int depth = 20;

    public int width = 256;
    public int height = 256;

    public float scale = 20f;

    void Start()
    {
        Terrain terrain = GetComponent<Terrain>();
        terrain.terrainData = GenerateTerrain(terrain.terrainData);
    }

    TerrainData GenerateTerrain(TerrainData terrainData)
    {
        terrainData.size = new Vector3(width, depth, height);
        terrainData.SetHeights(0, 0, GenerateHeights());
        return terrainData;
    }

    float(,) GenerateHeights()
    {
        float(,) heights = new float(width, height);
        for (int x = 0; x < width; x++)
        {
            for (int y = 0; y < height; y++)
            {
                heights(x, y) = CalculateHeight(x, y);
            }
            return heights;
        }
    }

    float CalculateHeight(int x, int y)
    {
        float xCoord = x / width * scale;
        float yCoord = y / height * scale;

        return Mathf.PerlinNoise(xCoord, yCoord);
    }

}

anybody help please