goto is not working

Hi every body,

I am doing some code that include the "goto" instruction but it don't work.

I have tried all the ways that I know but the same error keep going.

void loop(){
  Fallida:
  ...

void Error(){
  while(Serial.available()){
    Dato = Serial.read();
    delay(5);
  }
  Serial.flush();
  delay(5);
  Serial.write('r');
  llego='e';
  goto Fallida;
}

Error:
Arduino:1.6.6 (Windows 10), Placa:"Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

Label 'Fallida' used but not defined

exit status 1
label 'Fallida' used but not defined

May some body help me?

Don't use goto. It is only suitable for VERY experienced programmers (seriously).

...R

@sebaspz

Are you trying to use goto from the function Error() to a label in the function loop()? If you check the definition of C/C++ that is not possible. The compiler is actually telling you the same story :).

If you really need to do something like that there is a standard library; see the functions setjmp() and longjmp(). This is advanced stuff so you will need to do some reading first.

Cheers!