Function definition error at compilation

Hello, good day.
I am working on this project and I get this error at compilation.
The error message says "a function definition not allowed here before '{' token".

After reading through similar issues on the forum, it seemed to come from opening and closing braces not being used correctly and there were suggestions to use the Auto-format feature.

I have gone through my code severally ad I can't seem to find any opening brace that is not closed properly. I have also used the auto-format feature and it doesn't have problems with the code but I keep getting the error.

I have cut out the part of the code giving me the problem and pasted it.
I have attached the full code also.

  void loop()
  {
//Error is on the line above this

    keypressed = myKeypad.getKey();
    if (keypressed == 'E') {                    // E to open the lock
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("Enter code");            //Message to show
      GetCode();                          //Getting code function

      if (a == sizeof(code)) {       //The GetCode function assign a value to a (it's correct when it has the size of the code array)
        OpenDoor();                   //Open lock function if code is correct
      }
      else {
        lcd.clear();
        lcd.print("Wrong");          //Message to print when the code is wrong
        delay(2000);
        lcd.clear();
        lcd.print("System off!");
      }
      delay(2000);
      //lcd.clear();
      //lcd.print("Standby");             //Return to standby mode it's the message do display when waiting

    }


    if (keypressed == 'C') {                //To change the code it calls the changecode function
      ChangeCode();
      lcd.clear();
      lcd.print("System off!");                 //When done, it returns to standby mode
    }

    if (keypressed == 'F') {
      masteropen();
      lcd.clear();
      lcd.print("System bypassed");
      delay(1500);
      lcd.clear();
      lcd.print("System on");

    }

  }

Display_mine.ino (9.48 KB)

//Error is on the line above thisSo the error lies before your snippet.

I can't see your code, but try using the IDE's auto format tool on it.

Always post the details from an error message that indicate the line number where the compiler found the problem.

It seems that your GetCode() function is missing a closing }

...R

A wild guess as you have not posted all of your code (HINT) but is the closing brace of setup() in the correct place in the code, assuming that it even has a closing brace

And ... if you hover your cursor over a bracket the IDE will show which it thinks is the corresponding bracket - you can find mistakes that way

It was a shame when the facility to double click after bracket/brace of any kind and have the text of the block highlighted was removed from the IDE. It was vey useful

Thanks a lot guys.
Someone pointed out the problem and it's been fixed.
The GetCode function had no closing brace.

I'm glad I can get moving on the project.