Expected } at end of input

It keeps putting up the error even though i have tried to troubleshoot to fix the problem.

Arduino: 1.8.2 (Mac OS X), Board: "Arduino/Genuino Uno"

/Users/blank/Documents/Arduino/SD_Data/SD_Data.ino: In function 'void setup()':
SD_Data:63: error: expected '}' at end of input
}
^
SD_Data:63: error: expected '}' at end of input
SD_Data:63: error: expected '}' at end of input
SD_Data:63: error: expected '}' at end of input
SD_Data:63: error: expected '}' at end of input
exit status 1
expected '}' at end of input

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

    #include <SD.h>

    File myFile;
    File myData;
   File file;
    void setup()
    {
      Serial.begin(9600);
      Serial.print("Initializing SD card...");
     
      if (!SD.begin(4)) {
        Serial.println("initialization failed!");
        return;
      }
      Serial.println("initialization done.");
     
      if (SD.exists("num.txt")) {
      }
      else
      {
      myFile = SD.open("num.txt", FILE_WRITE); //TENTAR WRITE AND READ
      if (myFile) {
        Serial.print("Writing...");
        myFile.println("0");
        myFile.close();
        Serial.println("Done.");
      } else {
       
       int num = 0;
        if (myFile.available()) {
          num = myFile.parseInt();
          Serial.println(num);
          
        num++;
       int num2 = num;
        // close the file
        myFile.close();
      } else {
         // if the file didn't open, print an error:
        Serial.println("error opening test.txt");
      
     
      if (SD.exists("num.txt")) {
      SD.remove("num.txt");
      myFile = SD.open("num.txt",FILE_WRITE);
       if (myFile) {
        Serial.print("Writing...");
       // close the file:
        myFile.close();
        Serial.println("Done.");
      } 
      else 
      {
        Serial.println("Error opening num.txt");
      }


  void loop();
{
}

void loop();oops

If you indented properly, you'd see the other problem.

The error code is

Arduino: 1.8.2 (Mac OS X), Board: "Arduino/Genuino Uno"
SD_Data:8: error: expected unqualified-id before '{' token
{Serial.begin(9600);
^
exit status 1
expected unqualified-id before '{' token

#include <SD.h>
 int x = 0;
    File myFile;
    File myData;
   File file;
    void setup();
    
      {Serial.begin(9600);
      {Serial.print("Initializing SD card...");
     
      if (!SD.begin(4)); {
        Serial.println("initialization failed!");
        return;
      }
      {Serial.println("initialization done.");
     
      if (SD.exists("num.txt")) {
      }
      else
      {
      myFile = SD.open("num.txt", FILE_WRITE); //TENTAR WRITE AND READ
      if (myFile) {
        Serial.print("Writing...");
        myFile.println("0");
        myFile.close();
        Serial.println("Done.");
      } else {
       
       int num = 0;
        if (myFile.available()) {
          num = myFile.parseInt();
          Serial.println(num);
          
        num++;
       int num2 = num;
        // close the file
        myFile.close();
      } else {
         // if the file didn't open, print an error:
        Serial.println("error opening test.txt");
      
     
      if (SD.exists("num.txt")) {
      SD.remove("num.txt");
      myFile = SD.open("num.txt",FILE_WRITE);
       if (myFile) {
        Serial.print("Writing...");
       // close the file:
        myFile.close();
        Serial.println("Done.");
      } 
      else 
      {
        Serial.println("Error opening num.txt");
      
      
      
      }

       void loop();
  {
++x;
  }

void setup(); <------<<<< get rid of ;

Edit
void loop(); <-------<<<<

Use CTRL T to format your sketches.

.

larryd:
void setup(); <------<<<< get rid of ;

If i do that i get the error

Arduino: 1.8.2 (Mac OS X), Board: "Arduino/Genuino Uno"

/Users/gkrier/Documents/Arduino/SD_Data/SD_Data.ino: In function 'void setup()':
SD_Data:63: error: expected '}' at end of input
}
^
SD_Data:63: error: expected '}' at end of input
SD_Data:63: error: expected '}' at end of input
SD_Data:63: error: expected '}' at end of input
SD_Data:63: error: expected '}' at end of input
SD_Data:63: error: expected '}' at end of input
SD_Data:63: error: expected '}' at end of input
exit status 1
expected '}' at end of input

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

void loop(); <-------<<<<

Use CTRL T to format your sketches.

.

"If you're not willing to put in a little time learning, then why should we waste our time going over your code?"

Listen to Delta_G

.