{{fbdoc item="title" value="STOP"}}----
Halts program execution, and waits for a key press before ending the program.

{{fbdoc item="syntax"}}##
	[[KeyPgDeclare|declare]] [[KeyPgSub|sub]] **Stop** ( [[KeyPgByval|byval]] //retval// [[KeyPgAs|as]] [[KeyPgLong|long]] = 0 )
##
{{fbdoc item="usage"}}##
	**Stop**
##
{{fbdoc item="param"}}
	##//retval//##
		Error code returned to system.

{{fbdoc item="desc"}}
	Halts the execution of the program and stands by. It's  provided as a help to debugging, as it preserves the memory and doesn't close files. For normal program termination the ##[[KeyPgEnd|End (statement)]]## keyword should be used. An optional return value, an integer, can be specified to return an error code to the system. If no return value is given, a value of 0 is automatically returned.
	
	Note: STOP is not implemented properly yet; currently it is the same as [[KeyPgSystem|SYSTEM]].

{{fbdoc item="ex"}}
{{fbdoc item="filename" value="examples/manual/debug/stop.bas"}}%%(freebasic)
print "this text is shown"
sleep
stop
print "this text will never be shown"
%%

{{fbdoc item="diff"}}
	- None

{{fbdoc item="see"}}
	- ##[[KeyPgEnd|End (statement)]]##

{{fbdoc item="back" value="CatPgMisc|Miscellaneous"}}