Labels

Labels serve as targets for the 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 AVR.

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 : The label main marks the entry point of a program and must be present in the main module of every project. See Program Organization for more information.

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