94
Language Reference
©2000-2008 Tibbo Technology Inc.
public
Optional. If set, allows other compilation units (files in a
project) to access the function.
name
Required. Specifies the name for the function (used to call
it, etc).
byref
Optional. If present, the argument immediately following
this modifier will be passed
.
argument[1, 2...]
Optional. The name of the argument(s) passed to the
function; arguments must have a name which is a valid
identifier. This is a local identifier, used to refer to these
arguments within the body of the function.
as
Optional (required if arguments are specified). Precedes the
type definition.
type[1, 2...]
Optional (required if arguments are specified). Specifies
the
for the argument. Each argument name
must be followed with a type definition, even when
specifying several arguments of the same type.
statement[1,
2...]
Required. The body of code executed within the function;
specifies the actual 'work' done by the function.
Details
Subroutines cannot be nested (which is why their scope is defined as global or
HTML). Subroutines do not return values. Subroutines can call other subroutines
and functions.
Examples
sub
print_to_serial(s
as
byref
string
)
ser.setdata(s)
ser.send
s =
"OK"
' This sub actually returns something, if indirectly.
end
sub
Type Statement
Function:
Used to declare
-- combinatorial data types
that includes one or several member variables.
Syntax:
type type_name
name1 [ (bounds1) ] as type [ (max_string_size) ]
...
nameN [ (boundsN) ] as type [ (max_string_size) ]
end type
Scope:
Global, HTML and local
See Also:
Part
Description
64
43
54
81