function not declared problem. need help.

Hello, ive been working on this code, and I can figure out why i'm getting this error. I have the functions posted after the loop, but its still saying their "not declared in this scope". i don't know if it's because of the if statements, or what, but i tried double checking my brackets, and format. any help would be greatly appreciated!

it seems like most of the functions are coming up as "not declared"

#include <SPI.h>                          //oled libraries
#include <Wire.h>                         // "
#include <Adafruit_GFX.h>                 // "
#include <Adafruit_SSD1306.h>             // "

#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);     //define display

int x;                                   //used to switch between function screens
int buttonOne = 4;
int buttonTwo = 5;
int led = 6;                            //led pin on board
int fan = 7;                            //fan pin on board
int laser = 8;                          //laser pin on board
int debounce = 200;                     //universal wait after button push

void setup() {
  Serial.begin(9600);                   //begin serial communications for display
  pinMode(buttonOne, INPUT_PULLUP);     //use internal resistors
  pinMode(buttonTwo, INPUT_PULLUP);     //connect pin to ground via switch/button
  pinMode(laser, OUTPUT);
  pinMode(fan,OUTPUT);
  pinMode(led,OUTPUT);
  
  display.begin(SSD1306_SWITCHCAPVCC, 0x3c); //initializes display with logo ****make sure line doesn't read 0x3D but instead 0x3c****
  display.display();                         //must use display.display(); after every display command
  delay(2000);
  display.clearDisplay();                    //to avoid weird characters try to clear display befor updating text
}

void loop() {
  if (buttonOne == HIGH) {
    x++;
    delay(debounce);                                  //crude debounce
  }


  if (x == 0) {
    mainDisplay();
  }

  if (x == 1) {
    laserDisplay();                                          //displays the laser info screen
    if (digitalRead(buttonTwo) == HIGH) {
      toggleLaser();
      delay(debounce);
    }
  }

  if (x == 2) {
    ledDisplay();                                              //displays the LED info screen
    if (digitalRead(buttonTwo) == HIGH) {
      toggleLED();
      delay(debounce);
    }
  }

  if (x == 3) {

    fanDisplay();                                           //displays the fan info screen
    if (digitalRead(buttonTwo) == HIGH) {
      toggleFan();
      delay(debounce);
    }
  }

  if (x == 4) {
    int x = 0;           // equal to zero so there is a buffer where nothing will be affected
  }


}




/*
   Main display screen code===================================================================================================
*/

void mainDisplay() {
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0, 0);
  display.println("Mode");

  display.setTextColor(WHITE);
  display.println("Laser");
  if (digitalRead(laser) == HIGH) {
    display.setTextColor(WHITE);
    display.setCursor(64, 0);
    display.print("ON");
  }
  else {
    display.setTextColor(WHITE);
    display.setCursor(64, 0);
    display.print("off");
  }
  display.setTextColor(WHITE);
  display.println("led");
  if (digitalRead(led) == HIGH) {
    display.setTextColor(WHITE);
    display.setCursor(64, 0);
    display.print("ON");
  }
  else {
    display.setTextColor(WHITE);
    display.setCursor(64, 0);
    display.print("off");
  }

  display.setTextColor(WHITE);
  display.println("Fan");
  if (digitalRead(fan) == HIGH) {
    display.setTextColor(WHITE);
    display.setCursor(64, 0);
    display.print("ON");
  }
  else {
    display.setTextColor(WHITE);
    display.setCursor(64, 0);
    display.print("off");
  }

  display.display();
  delay(200);
  display.clearDisplay();
}

/*
   Laser code==========================================================================================================
*/

void laserDisplay() {

  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0, 0);
  display.println("Mode");

  display.setTextColor(WHITE);
  display.println("Laser");
  if (digitalRead(laser) == HIGH) {
    display.setTextColor(WHITE);
    display.setCursor(64, 0);
    display.print("ON");
  }
  else {
    display.setTextColor(WHITE);
    display.setCursor(64, 0);
    display.print("off");
  }
}
//==================================
void toggleLaser()  {
  if (digitalRead(laser) == LOW)
    digitalWrite (laser, HIGH);
  laserDisplay();

  else
    digitalWrite(laser, LOW);
  laserDisplay();
}


/*
   LED code =========================================================================================================
*/

void ledDisplay() {

  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0, 0);
  display.println("Mode");

  display.setTextColor(WHITE);
  display.println("led");
  if (digitalRead(led) == HIGH) {
    display.setTextColor(WHITE);
    display.setCursor(64, 0);
    display.print("ON");
  }
  else {
    display.setTextColor(WHITE);
    display.setCursor(64, 0);
    display.print("off");
  }
}

void toggleLED() {
  if (digitalRead(led) == LOW) {
    digitalWrite (led, HIGH);
    ledDisplay();
  }
  else {
    digitalWrite(led, LOW);
    ledDisplay();
  }


  /*
     Fan code =========================================================================================================
  */

  void fanDisplay() {

    display.clearDisplay();
    display.setTextSize(1);
    display.setTextColor(WHITE);
    display.setCursor(0, 0);
    display.println("Mode");

    display.setTextColor(WHITE);
    display.println("Fan");
    if (digitalRead(fan) == HIGH) {
      display.setTextColor(WHITE);
      display.setCursor(64, 0);
      display.print("ON");
    }
    else {
      display.setTextColor(WHITE);
      display.setCursor(64, 0);
      display.print("off");
    }

  }

  void toggleFan() {
    if (digitalRead(fan) == LOW) {
      digitalWrite(fan, HIGH);
      fanDisplay();
    }

    else {
      digitalWrite(fan, LOW);
      fanDisplay();
    }
  }

I found the problem. I missed some brackets in one section.

and THANK YOU! I didn't even realize i had missed making that

if (digitalRead(buttonOne) == HIGH){
...
}

that explains part of why it wasn't working!

Your code is missing a } to indicate the end of toggleLED().

Use IDE menu tools -> autoformat. After that, all function definitions need to start at the beginning of a line.

void toggleLED() {
  ...
  ...

  /*
     Fan code =========================================================================================================
  */

  void fanDisplay() {

As can be seen, void fanDisplay() does not start at the beginning of a line but void toggleLED() did. Conclusion: mismatch in number of { and } just before void fanDisplay().