how to return a value in method inside a loop? : its actually can't be returned.
because it have loop in it.

private int IsPrime (int startNumb , int endNumb)
        {
            bool bilPrima = true;

            for (int i = startNumb; i<= endNumb; i++)
            {
                for (int j = 2; j <= i; j++)
                {
                    if (i%j==0)
                    {
                        bilPrima = false;
                        break;
                    }
                }
                if (bilPrima)
                {
                    bilPrima = true;
                    return i;
                }
                else
                {
                    return 0;
                }
            }
            

        }
help me pls :(