User`s manual

Loops are a specific way to control the program flow. By using loops, you can
execute a sequence of statements repeatedly, with a control condition or variable
to determine when the execution stops.
You can use the standard
break and continue to control the flow of a
do..loop until, while, or for statement. Break terminates the statement in
which it occurs, while continue begins executing the next iteration of the
sequence.
mikroBasic has three kinds of control loop instructions:
DO..LOOP UNTIL statement
WHILE statement
FOR statement
Note that certain operations may take longer time to be executed, which can lead
to undesired consequences.
If you add two variables of short type and assign the result to short, it will be
faster than to add two longint and assign value to longint, naturally.
Take a look at the following code :
dim Sa as short
dim Sb as short
dim Saaaa as longint
dim Sbbbb as longint
for Sa = 0 to 100
Sb = Sb + 2
next Sa
for Saaaa = 0 to 100
Sbbbb = Sbbbb + 2
next Saaaa
end.
PIC will execute the first loop considerably faster.
mikroBASIC
- Basic Compiler for Microchip PIC microcontrollers
92
mikroBASIC
MikroElektronika: Development tools - Books - Compilers
making it simple...
page
LOOPS
Runtime
Behavior