Confused about if statements

int sumPos = 0;
int sumNeg = 0;
bool isEmpty = false;
if (input is [])
{
    Console.WriteLine("[] you entered an empty array");
    isEmpty = true;
}
else //the line I talk about when I add else if(isEmpty = false)
{
    Debug.WriteLine("isEmpty = false");
    foreach (int i in input)
    {
        if (i > 0)
        {
            sumPos += i;
        }
        else if (i < 0)
        {
            sumNeg += i;
        }
    }
    Console.WriteLine("Sum of the positives: " + sumPos + "\nSum of the negatives: " + sumNeg);
}
        


when I add else if instead of else the condition is met even in the debugging but it skips the else if statement
Was this page helpful?