Help With Understanding Error Messages

I don't understand these messages, hoping someone can help me sort these out.

Arduino: 1.6.1 (Windows 8.1), Board: "Arduino Uno"

C:\Program Files (x86)\Arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10601 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard C:\Users\NATHAN~1\AppData\Local\Temp\build4127794460967306229.tmp\Crossfade_RGB_LED.cpp -o C:\Users\NATHAN~1\AppData\Local\Temp\build4127794460967306229.tmp\Crossfade_RGB_LED.cpp.o

Crossfade_RGB_LED.ino: In function 'void loop()':

Crossfade_RGB_LED.ino:97:7: error: expected '}' before 'else'

Crossfade_RGB_LED.ino:101:8: error: expected '}' before 'else'

Crossfade_RGB_LED.ino:106:11: error: 'else' without a previous 'if'

Crossfade_RGB_LED.ino:112:13: error: 'else' without a previous 'if'

Crossfade_RGB_LED.ino:114:33: error: expeArduino: 1.6.1 (Windows 8.1), Board: "Arduino Uno"

C:\Program Files (x86)\Arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10601 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard C:\Users\NATHAN~1\AppData\Local\Temp\build4127794460967306229.tmp\Crossfade_RGB_LED.cpp -o C:\Users\NATHAN~1\AppData\Local\Temp\build4127794460967306229.tmp\Crossfade_RGB_LED.cpp.o

Crossfade_RGB_LED.ino: In function 'void loop()':

Crossfade_RGB_LED.ino:97:7: error: expected '}' before 'else'

Crossfade_RGB_LED.ino:101:8: error: expected '}' before 'else'

Crossfade_RGB_LED.ino:106:10: error: 'else' without a previous 'if'

Crossfade_RGB_LED.ino:112:13: error: 'else' without a previous 'if'

Crossfade_RGB_LED.ino:114:33: error: expected ';' before '{' token

Error compiling.cted ';' before '{' token

Crossfade_RGB_LED.ino: At global scope:

Crossfade_RGB_LED.ino:119:4: error: expected declaration before '}' token

Error compiling.

And here is the code:

// Output
int redPin = 9;   // Red LED,   connected to digital pin 9
int grnPin = 10;  // Green LED, connected to digital pin 10
int bluPin = 11;  // Blue LED,  connected to digital pin 11
int buttonPin = 7; // Button Input Pin, connected to Digital pin 7



int buttonState = 0;

int wait = 0;      // 10ms internal crossFade delay; increase for slower fades
int hold = 30;       // Optional hold when a color is complete, before the next crossFade
int DEBUG = 0;      // DEBUG counter; if set to 1, will write values back via serial
int loopCount = 20; // How often should DEBUG report?
int repeat = 1;     // How many times should we loop before stopping? (0 for no stop)
int j = 0;          // Loop counter for repeat



// Varibles will change
int buttonPushCounter = 0; // counter for number of button presses

// Set up the LED outputs
void setup()
{
  pinMode(redPin, OUTPUT);   // sets the pins as output
  pinMode(grnPin, OUTPUT);   
  pinMode(bluPin, OUTPUT); 
  pinMode(buttonPin, INPUT); // and the button pin as input
  
}

// Main program
void loop() {
if (buttonState = digitalRead(buttonPin)) {
if (buttonState == HIGH) { // if the button is high
  if (buttonPushCounter == 0) { // and if the button was pushed 0 times before...
    buttonPushCounter++;
    analogWrite(redPin, 255);
  }  else {
    if (buttonPushCounter == 1) { // if the button was pushed once...
      buttonPushCounter++;
      analogWrite(grnPin, 255);
    }}else {
     if (buttonPushCounter == 2) { 
       buttonPushCounter++;
       analogWrite(bluPin, 255);
     }}else {
       if (buttonPushCounter == 3) {
         buttonPushCounter++;
         analogWrite(redPin, 255);
         analogWrite(grnPin, 255);
       }}else {
         if (buttonPushCounter == 4) {
           buttonPushCounter++;
           alldone:
           analogWrite(redPin, 204);
           analogWrite(bluPin, 204);
         }} else {
           if (buttonPushCounter >=5); { 
           buttonPushCounter = 4{goto alldone;}
           }
         }
       }

It is hard to read your code because you didn't do the following:

To post:

  1. Use CTRL-T in the Arduino IDE to autoformat your code.
  2. Paste the autoformatted code between code tags (the </> button)
    so that we can easily see and deal with your code.

Are you certain that you want to write

if (buttonState = digitalRead(buttonPin)) {

?

digitalRead is documented to return LOW or HIGH. These happen to correspond - currently - to false and true but not necessarily in the future. Furthermore, the single equal sign assigns a value to buttonState.

goto, as in

           buttonPushCounter = 4{goto alldone;}

is usually unnecessary in C or C++, and often indicates an error in the thought process. Are you CERTAIN that you need a goto ?

To the question that you asked, you probably have curly brackets ( { and } ) in unintended places.