END - QB64 Wiki

END

From QB64 Wiki

(Difference between revisions)
Jump to: navigation, search
m
(style guidelines)
 
Line 1: Line 1:
-
The {{KW|END}} statement terminates a program without an immediate exit or ends a procedure or statement block.  
+
The [[END]] statement terminates a program without an immediate exit or ends a procedure or statement block.  
{{PageSyntax}}
{{PageSyntax}}
-
::: END
+
: [[END]] [{{Parameter|returnCode%}}]
-
::: END [[IF...THEN|IF]]
+
: [[END]] [[IF...THEN|IF]]
-
::: END [[TYPE]]
+
: [[END]] [[TYPE]]
-
::: END [[SELECT CASE|SELECT]]
+
: [[END]] [[SELECT CASE|SELECT]]
-
::: END [[SUB]]
+
: [[END]] [[SUB]]
-
::: END [[FUNCTION]]
+
: [[END]] [[FUNCTION]]
 +
: END [[DECLARE LIBRARY|DECLARE]]
-
QB64 {{PageSyntax}}
 
-
::: END [return_code%]
 
-
::: END [[DECLARE LIBRARY|DECLARE]]
 
-
 
+
{{PageDescription}}
-
* In '''QB64''' END can be followed by a code that can be read in another module using the [[SHELL (function)|_SHELL]] or [[_SHELLHIDE]] function.
+
* In '''QB64''', [[END]] can be followed by a code that can be read by another module using the [[SHELL (function)|_SHELL]] or [[_SHELLHIDE]] function (known as [https://blogs.msdn.microsoft.com/oldnewthing/20080926-00/?p=20743 '''errorlevel'''])
-
* When END is used to end a program a pause and "Press any key to continue..." is displayed at the bottom of the window.  
+
* When END is used to end a program, there is a pause and the message "Press any key to continue..." is displayed at the bottom of the program's window.  
-
* If the program does not use END or [[SYSTEM]] the program will still end with a pause and display "Press any key to continue...".
+
* If the program does not use END or [[SYSTEM]], the program will still end with a pause and display "Press any key to continue...".
-
* In '''QB64''' [[SYSTEM]] will end the program immediately and close the window.
+
* In '''QB64''', [[SYSTEM]] will end the program immediately and close the window.
-
* The '''QB64''' [[_EXIT (function)]] can block a user's Ctrl + Break key press or click on the window X box until the program is ready.
+
* The '''QB64''' [[_EXIT (function)]] can block a user's Ctrl + Break key presses and clicks on the window's close button (X button) until the program is ready to close.
-
* When running a Qbasic BAS module from the command line, use [[SYSTEM]] to avoid returning to the [[IDE]].
+
 +
{{PageExamples}}
''Example:'' In QB64 you won't return to the IDE unless you are using it to run or edit the program module.
''Example:'' In QB64 you won't return to the IDE unless you are using it to run or edit the program module.
Line 42: Line 40:
{{OutputEnd}}
{{OutputEnd}}
:''Explanation:''"Hello no one!" isn't returned because the program ended with the END statement no matter what is after that.
:''Explanation:''"Hello no one!" isn't returned because the program ended with the END statement no matter what is after that.
-
:The message "Press any key to continue..." is displayed after the program ends in QB or '''QB64'''.
+
:The message "Press any key to continue..." is displayed after the program ends, both in QBasic and in '''QB64'''.

Current revision as of 14:48, 19 September 2017

The END statement terminates a program without an immediate exit or ends a procedure or statement block.


Contents

Syntax

END [returnCode%]
END IF
END TYPE
END SELECT
END SUB
END FUNCTION
END DECLARE


Description

  • In QB64, END can be followed by a code that can be read by another module using the _SHELL or _SHELLHIDE function (known as errorlevel)
  • When END is used to end a program, there is a pause and the message "Press any key to continue..." is displayed at the bottom of the program's window.
  • If the program does not use END or SYSTEM, the program will still end with a pause and display "Press any key to continue...".
  • In QB64, SYSTEM will end the program immediately and close the window.
  • The QB64 _EXIT (function) can block a user's Ctrl + Break key presses and clicks on the window's close button (X button) until the program is ready to close.


Examples

Example: In QB64 you won't return to the IDE unless you are using it to run or edit the program module.

PRINT "Hello world!" END PRINT "Hello no one!"

Returns:

Hello world! Press any key to continue...

Explanation:"Hello no one!" isn't returned because the program ended with the END statement no matter what is after that.
The message "Press any key to continue..." is displayed after the program ends, both in QBasic and in QB64.


See also



Navigation:
Go to Keyword Reference - Alphabetical
Go to Keyword Reference - By usage
Go to Main WIKI Page
Personal tools