STOP: Difference between revisions
Jump to navigation
Jump to search
Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link
No edit summary |
No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
{{PageSyntax}} | {{PageSyntax}} | ||
: STOP | |||
{{PageDescription}} | |||
* STOP used in the QBasic IDE does not close any files or go to the operating system. It returns to the IDE. | * STOP used in the QBasic IDE does not close any files or go to the operating system. It returns to the IDE. | ||
* In the QB64 compiler, STOP closes the program window and returns to the IDE when the code is compiled from there. | * In the QB64 compiler, STOP closes the program window and returns to the IDE when the code is compiled from there. | ||
* STOP is ONLY used for debugging purposes and should not be used to exit programs! | * STOP is ONLY used for debugging purposes and should not be used to exit programs! | ||
* STOP can also be used to suspend an event trap in the following statements: [[KEY(n)]], [[STRIG(n)]] and [[TIMER]]. The trap can be turned back on with [[ON]] and returns any trap events since '''STOP''' was used. | * STOP can also be used to suspend an event trap in the following statements: [[KEY(n)]], [[STRIG(n)]] and [[TIMER|TIMER(n)]]. The trap can be turned back on with [[ON]] and returns any trap events since '''STOP''' was used. | ||
{{PageExamples}} | |||
''Example:'' When run in the QBasic IDE, the program will return to the IDE at STOP. Press F5 to finish the program. | ''Example:'' When run in the QBasic IDE, the program will return to the IDE at STOP. Press F5 to finish the program. | ||
{{CodeStart}} | {{CodeStart}} | ||
Line 25: | Line 27: | ||
{{PageSeeAlso}} | |||
* [[END]], [[SYSTEM]] | * [[END]], [[SYSTEM]] | ||
* [[ON]], [[OFF]] | * [[ON]], [[OFF]] |
Latest revision as of 17:02, 24 February 2023
The STOP statement is used to stop program execution when troubleshooting a program or to suspend event trapping.
Syntax
- STOP
Description
- STOP used in the QBasic IDE does not close any files or go to the operating system. It returns to the IDE.
- In the QB64 compiler, STOP closes the program window and returns to the IDE when the code is compiled from there.
- STOP is ONLY used for debugging purposes and should not be used to exit programs!
- STOP can also be used to suspend an event trap in the following statements: KEY(n), STRIG(n) and TIMER(n). The trap can be turned back on with ON and returns any trap events since STOP was used.
Examples
Example: When run in the QBasic IDE, the program will return to the IDE at STOP. Press F5 to finish the program.
PRINT "start" SLEEP 3 STOP PRINT "resumed" |
- Explanation: QB64 will STOP the program and close the window as it does not have an interpreter to run the rest of the code.
See also