problem with" for" statement

I have an elegoo UNO R3 . Have copied out Motor Speed sketch in Arduino for Dummies 3 times

for (int motorValue = 0; motorValue<=255; motorValue +=5);{
analogWrite(motorPin,motorValue );

for (int motorValue = 255; motorValue>=0; motorValue-=5);{
analogWrite( motorPin, motorValue);

get error message "motorValue"was not declared in this scope.

Please post your full sketch. If possible you should always post code directly in the forum thread as text using code tags (</> button on the toolbar). This will make it easy for anyone to look at it, which will increase the likelihood of you getting help. If the sketch is longer than the forum will allow then it’s ok to add it as an attachment.

Please always do a Tools > Auto Format on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read. If you’re using the Arduino Web Editor then you will not have access to this useful tool. I recommend using the standard Arduino IDE instead.

When your code requires a library that’s not included with the Arduino IDE please always post a link(using the chain links icon on the toolbar to make it clickable) to where you downloaded that library from or if you installed it using Library Manger(Sketch > Include Library > Manage Libraries) then say so and state the full name of the library.

When you encounter an error you’ll see a button on the right side of the orange bar “Copy error messages”. Click that button. Paste the error in a message here USING CODE TAGS (</> button on the toolbar).

Please use code tags when posting code…

You have a ; after each of your for statements. ; means “end of statement” and this is your problem.

//This is wrong
for (int motorValue = 0;  motorValue<=255; motorValue +=5);{
  analogWrite(motorPin,motorValue );

//This is right
for (int motorValue = 0;  motorValue<=255; motorValue +=5)
  analogWrite(motorPin,motorValue );