Simon Says project

Is this a mistake? It is outside of your function and seems like it's floating out there...

boolean compareUser(int seq[] , int user[])
{
  int i = 0;
for (int y = 0;  y < 4; y++)
{
  if(seq[y] == user[y])
  {
    Serial.println("Match good job");

    i++;
        
  }

if( i == 4 || i == 3)
{
  valid = true;
}

  if(seq[y] != user[y])
  {
    fail();
    valid = false;  
 }
}

}; // end of comparing function