User manual

mikroBasic PRO for PIC32
MikroElektronika
229
end if
Delay_ms(1000)
wend
Now we can work with CF card ...
Lcd_Out(1, 1, “Card detected “)
Continue Statement
You can use the continue statement within loops to “skip the cycle”:
- continue statement in the for loop moves program counter to the line with keyword for after incrementing the
counter,
- continue statement in the while loop moves program counter to the line with loop condition (top of the loop),
- continue statement in the do loop moves program counter to the line with loop condition (bottom of the loop).
continue jumps here
for i = ...
...
continue
...
next i
continue jumps here
while condition
...
continue
...
wend
do
...
continue
...
continue jumps here
loop until condition
Exit Statement
The exit statement allows you to break out of a routine (function or procedure). It passes the control to the rst
statement following the routine call.
Here is a simple example:
sub procedure Proc1()
dim error as byte
... ‘ we’re doing something here
if error = TRUE then
exit
end if
... ‘ some code, which won’t be executed if error is true
end sub
Note: If breaking out of a function, return value will be the value of the local variable result at the moment of exit.
Return Statement
The return statement causes execution to leave the current subroutine and resume at the point in the code immediately
after where the subroutine was called. It’s mainly intended to be used with gosub statement.
Return statement suffers from the same sort of readability problems as the GOTO statement and like goto, the use of
return statement is generally discouraged.