90
Language Reference
©2000-2008 Tibbo Technology Inc.
:
Optional. Separator for multiple statements on a single line.
Covered under
.
Details
When the expression evaluates to true, the block of code immediately following
the then keyword is executed. If it evaluates to false, the code immediately
following the else keyword is executed; if there is no else keyword, program flow
resumes from the line immediately following the end if keyword.
When using the single-line syntax (as in the lower example above), an if
statement must not be terminated using an end if. This is the only construct
under Tibbo Basic where line end matters. So, if you want to have several
statements in such a construct, you need to place them all in the same line, and
separate them with colons.
If... then... else statements may be nested.
Currently, single-line if... then statements cannot contain an else
clause.
The elseif syntax is not currently supported at all (even on multi-line
if... then statements).
Examples
if
net.failure=1
then
if
sys.runmode=
0
then
ser.setdata(
"Ethernet failure!"
):ser.send
'massage when in debug mode
sys.halt
else
if
net.linkstate=
0
then
ser.setdata(
"No Ethernet link!"
)
else
if
net.linkstate=
1
then
ser.setdata(
"Linked at 10Mbit/s."
)
else
ser.setdata(
"Linked at 100Mbit/s."
)
end
if
end
if
ser.send
end
if
Include Statement
Function:
Includes a file (such as a header file) at the point of the
statement.
Syntax:
include “filename”
Scope:
Global and HTML
See Also:
---
Part
Description
39