code structural problem with a function for counting LDR changes

Hello. I am programming a program to map a room with a robot. I have this function that counts the amount of turns the wheel have.

long countTurn(){//function for counting wheel truns and use for map
  long countTurn=0
  ButtonState=digitalRead(LDRpin1);
  if (ButtonState!=LastButtonState){
    if(ButtonState==HIGH){
      countTurn++;
    }
    else if(ButtonState==LOW){
      ;
    }
  }
  return countTurn
}

It said that "a function-definition is not allowed" after long countTurn"before '{' token" from my code. I do not understand what I have done wrong, please help me out!

  long countTurn=0At the very least this line should be terminated with a semicolon and having a variable with the same names as a function could be confusing.

Do us all a favour and post your whole program.

I am so sorry, but I have barely finished any of the program and I think posting the entire thing out would only make everything a lot more confusing. I am still at the stage of writing my program.

Well, start adding semicolons where semicolons are required.
See how that goes.

I have made the change, but the same error message is still coming up.

The_Leo:
I have made the change, but the same error message is still coming up.

But we still can't see the code.

#include<Wire.h>
#include<SD.h>
const int straightpin=4;
const int backpin=5;
const int leftpin=6;
const int rightpin=7; //direction reading pins
const int LDRpin1=1;  //LDR sensor pins
const int direction1=12;
const int direction2=13;
const int brake1=9;
const int brake2=8;
const int motor1=3;   // motor 1 controll front and back; motor 2 controll left and right
const int motor2=11;  //motor moving pins setup
const int forWard=HIGH;
const int backWard=LOW; 
const int off=LOW;
const int on=HIGH;  //variables to make life easier
int x=0;
int y=0;  //cordinates for the map
void setup(){
  pinMode(straightpin,INPUT);
  pinMode(backpin,INPUT);
  pinMode(leftpin,INPUT);
  pinMode(rightpin,INPUT);
  pinMode(LDRpin1,INPUT);// sensor pin as output
  pinMode(12,OUTPUT);
  pinMode(13,OUTPUT); 
  pinMode(9,OUTPUT);
  pinMode(8,OUTPUT);//controlling pins as input
  digitalWrite(brake1,on);
  digitalWrite(brake2,on);
}

 long countTurn(){//function for counting wheel truns and use for map
  long countTurn=0;
  ButtonState=digitalRead(LDRpin1);
  if (ButtonState!=LastButtonState){
    if(ButtonState==HIGH){
      countTurn++;
    }
    else if(ButtonState==LOW){
      ;
    }
  }
  return countTurn;
}
int RecieveNTurns(){
  while(1<Wire.available()){
    char x=Wire.read();
    return x;
  }
}
void MapOrFallowProcessor
void Go_Straight()
{
 digitalWrite(brake1,off);
 digitalWrite(direction1,forWard);
 digitalWrite(motor1, 255);
 
}

so sorry, but this is all I got, it's not close to complete and it might be confusing

...and we can't see the error message

void MapOrFallowProcessor
void Go_Straight()

The error message highlights " long countTurn(){//function for counting wheel truns and use for map"
and says "a function-definition is not allowed here before '{' token"

And what about the mess highlighted in reply #8?
And the variable with the same name as the function?

They were not highlighted as an error...yet... but I do see what you are talking about. I left it there because I was planning to finish that part later. Is it that which caused this problem that I posted?