85
TIDE and Tibbo BASIC User Manual
©2000-2008 Tibbo Technology Inc.
Exit Statement
Function:
Immediately terminates execution of function or a loop.
Syntax:
exit do
exit for
exit function
exit sub
exit while
Scope:
Local and HTML
See Also:
,
Part
Description
exit do
Provides an alternative way to leave a do... loop
statement. Can be used only from within such a loop. exit
do transfers the control to the statement following the loop
statement. When used within nested do... loop
statements, exit do transfers control to the loop which is
one nested level above the loop in which exit do occurs.
exit for
Provides a way to exit a for loop. Can be used only within
for... next or for each... next loops. When using exit for,
control is passed to the statement which is immediately
after the next statement. When used within nested for
loops, exit for transfers control to the loop which is one
nested level above the loop in which exit for occurs.
exit function
Exits the current function. Execution resumes from the
point where the function was originally called.
exit sub
The same as exit function, only used for subroutine
procedures.
exit while
Exists a while loop before the condition it is dependant
upon evaluates as false.
Details
Do not confuse exit (which just quits) with end (which defines the end of a section
of code).
Examples
function
send_data
as
integer
' before sending data, we want to make sure Ethernet interface is OK
if
net.failure <> 0
then
send_data =
1
' this way we notify the caller of an error
exit
function
end
if
' Ethernet interface is OK, proceed with sending data
end
function
82
86
87
93
95