67
TIDE and Tibbo BASIC User Manual
©2000-2008 Tibbo Technology Inc.
As can be seen, this chain takes up 7 bytes of memory. However, this memory can
be the same memory used for the on_event_1 chain, because these two chains will
never execute at the same time. Thus, the total memory required for our project
remains at 11 bytes.
A typical project usually includes a number of
. Naturally, these
variables are allocated their exclusive space that is not shared with local variables
of procedures. Variables of HTML scope, which are local by nature, are allocated
exclusive memory space as if they were global (this is an unfortunate byproduct of
the way compiler handles HTML pages). Hence, it is more economical to implement
necessary functionality in procedures invoked from HTML pages rather than include
BASIC code directly into the body of HTML files.
Introduction to Control Structures
Control Structures are used to choose what parts of your program to execute,
when to execute them, and whether to repeat certain blocks of code or not (and
for how many iterations).
The two main types of control structures are
and
.
4.2.6.1
Decision Structures
Decision Structures are used to conditionally execute code, according to the
existence or absence of certain conditions.
Common uses for decision structures are to verify the validity of arguments, to
handle errors in execution, to branch to different sections of code, etc.
An example of a simple decision structure would be:
dim
x, y
as
byte
dim
s
as
string
if
x < y
then
s =
"x is less than y"
else
s =
"x is greater than, or equal to, y"
end
if
57
67
68