Labels

Labels serve as targets for goto and gosub statements. Mark the desired statement with label and colon like this:

label_identifier : statement

No special declaration of label is necessary in mikroBasic PRO for PIC.

Name of the label needs to be a valid identifier. The labeled statement and goto/gosub statement must belong to the same block. Hence it is not possible to jump into or out of routine. Do not mark more than one statement in a block with the same label.

  Note :

Here is an example of an infinite loop that calls the procedure Beep repeatedly:

loop: 
  Beep
goto loop
Copyright (c) 2002-2012 mikroElektronika. All rights reserved.
What do you think about this topic ? Send us feedback!
Want more examples and libraries? 
Find them on LibStock - A place for the code