Pages: [1]   Go Down
Author Topic: goto statement  (Read 1156 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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??????? :-?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Pages: [1]   Go Up
Jump to: