Go Down

Topic: goto statement (Read 2408 times) 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
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy