MC-Basic:PROGRAM ... END PROGRAM
Language: | English • 中文(简体) |
---|
The PROGRAM…END PROGRAM keywords are used to delimit the main section of code in a task. Task variables, defined using DIM SHARED, must appear before the Program keyword. Local variables (defined using DIM alone), appear after the Program keyword, but before the code. Subprograms must appear after the End Program keywords.
When a program is loaded into memory (using the LOAD command), it does not start executing until the STARTTASK command is executed. By adding the Continue keyword to the Program keyword, the program automatically starts executing after it is loaded.
When a task reaches End Program, it stops running, but remains loaded in memory. End Program may be replaced by Terminate Program. In this case, the task is automatically unloaded from memory when it finishes.
Syntax
Program
<code to execute>
End Program
Availability
All versions
Scope
Task, Multi-line commands via entry station
Examples
Dim Shared var1 as Long Program Dim I As Long for I = 1 to 10 var1 = var1 + 1 Next I End Program