Jump Statement Example
Previous Topic  Next Topic 

Below is an example of a jump statement being used to jump from a function back to a label in the main..endmain section:


main


   // Call the function

   f();


:end_of_program


  restart;

endmain



func f()


     // call another function

     g();

end



func g()


     // Jump back to labale in main program (stack is cleared)

     jump end_of_program;

end

  


Note that is is illegal to jump to a label that is not in the main..endmain section:


main

   f()

endmain



func f()

int a;


mylabel:


     a++;

     // This is illegal!

     jump mylabel;

      

endfunc