Go Down

Topic: goto statement (Read 1 time) previous topic - next topic

noise0

excuse me

arduino reference states I can jump to a label using the GOTO statement
http://www.arduino.cc/en/Reference/Goto

I try:
Code: [Select]
for(byte r = 0; r < 255; r++){
   for(byte g = 255; g > -1; g--){
       for(byte b = 0; b < 255; b++){
           if (analogRead(0) > 250){ goto bailout;}
           // more statements ...
       }
   }
}
bailout:


but I give this error

In function 'void loop()':
error: expected primary-expression before '}' token

Using "Arduino - 0012 Alpha"

what is the problem??????? :-?

noise0

i have found the solution
after a label there must be a statement of any sort....
to close curly bracket directly after label: in not accepted
:o

Go Up