Code must be
placed inside functions. Functions are declared with the
func statement. Each function must be ended with the
endfunc statement.
func main()
..........
..........
endfunc
Also note that
the first function in your program does not have main(). I
just do it for consistency. The first function is always
the entry point into your chip.
Calling User Functions
To call one of
your own functions just use the name.
func main()
domyfunc()
endfunc
func domyfunc()
......
endfunc
You can pass
values to variables by including them as shown.
func main()
domyfunc(21,5)
endfunc
func domyfunc(varb1,varb2)
......
endfunc
As shown above
you may pass a hard coded value. You may also pass the value
of a variable as well. To return a value use the exit command
as shown.
func main()
dim ret
ret =
domyfunc(21,5)
endfunc
func domyfunc(varb1,varb2)
exit(varb1
+ varb2)
endfunc
If a variable is
declared in the func statement as shown above its just like using
the dim command.
That gives you a rough example of what
the syntax is like. Just keep in mind you can have if statements and
gosub's and goto's within each function.