i need help on code

I need help my project says expected initializer before ‘currentStateCLK’ on my code

 // Include the Servo Library
 #include <Servo.h>
 
 // Rotary Encoder Inputs
 #define inputCLK 4
 #define inputDT 5
 
 // Create a Servo object
 Servo myservo;
 
 int counter = 0; 
 int currentStateCLK;
 int previousStateCLK; 

 void setup() { 
   
   // Set encoder pins as inputs  
   pinMode (inputCLK,INPUT);
   pinMode (inputDT,INPUT);
   
   // Setup Serial Monitor
   Serial.begin (9600);
   
   // Attach servo on pin 9 to the servo object
   myservo.attach(9);
   
   // Read the initial state of inputCLK
   // Assign to previousStateCLK variable
   previousStateCLK = digitalRead(inputCLK);

 } 

 void loop() 
  
  // Read the current state of inputCLK
currentStateCLK; = digitalRead(inputCLK);
    
   // If the previous and the current state of the inputCLK are different then a pulse has occured
   if (currentStateCLK != previousStateCLK){ 
       
     // If the inputDT state is different than the inputCLK state then 
     // the encoder is rotating counterclockwise
     if (digitalRead(inputDT) != currentStateCLK) { 
       counter --;
       if (counter<0){
        counter=0;
       }
      
     } else {
       // Encoder is rotating clockwise
       counter ++;
       if (counter>180){
        counter=180;
       }
       
     }
     
     // Move the servo
     myservo.write(counter);
      
     Serial.print("Position: ");
     Serial.println(counter);
   } 
   // Update previousStateCLK with the current state
   previousStateCLK = currentStateCLK; 
 }

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

harlowismypal:

currentStateCLK; = digitalRead(inputCLK);

Please study the reference page for the assignment operator until you can find what is wrong with this line:
https://www.arduino.cc/reference/en/language/structure/arithmetic-operators/assignment/

that was a good page but it did not help with my code issue

look for the stray semi-colon!

so should I remove the semicolon

“so should I remove the semicolon ”

So what happened when you did?

A semicolon ends a line of code.

You need one for each line, but no extras.

thank you I removed the extra semicolon but same problem

Most likely you removed the wrong “extra”.

See post #1.

Don’t forget to post your updated code (using code tags and in a new post) so we can see the mistakes.

void loop()
<———<<<< missing a >>>>———> {
// Read the current state of inputCLK
currentStateCLK = digitalRead(inputCLK);

Use CTRL T to format your code.
Attach your ‘complete’ sketch between code tags, use the </> icon in the posting menu.
[code]Paste your sketch here[/code] .

ok I removed a semicolon so instead of currentStateCLK; = digitalRead(inputCLK); I did currentStateCLK = digitalRead(inputCLK);

void loop()
{ <------<<<< you are also missing the opening brace