Normally an ARMbasic program will start at the first
statement in the BASIC source. This can be changed by having a MAIN:
somewhere else in the program. When a MAIN: does exist, the program will
begin at this point.
MAIN: is useful for programs that use FUNCTIONs or SUBs and have those FUNCTIONs or SUBs at the beginning of the source. This also includes FUNCTIONs or SUBs that are #include'd in the source.
Statements before the MAIN will not be executed, unless they are called or GOTO'd. But those statements can be used to define variables or SUB. The compiler attempts to show errors on code that it assumes is unreachable (since version 9.40).
A MAIN is not required in a program, but the compiler assumes that there will be one. To get around that you can have a label at the start of the program and execution will begin there.