END Statement Details Syntax END [{DEF | FUNCTION | IF | SELECT | SUB | TYPE}] Statement Description END DEF Ends a multiline DEF FN function definition. You must use END DEF with a multiline DEF FN. END FUNCTION Ends a FUNCTION procedure definition. You must use END FUNCTION with FUNCTION. END IF Ends a block IF...THEN...ELSE statement. You must use END IF with block IF...THEN...ELSE. END SELECT Ends a SELECT CASE block. You must use END SELECT with a SELECT CASE statement. END SUB Ends a BASIC subprogram. You must use END SUB with SUB. END TYPE Ends a user-defined type definition. You must use END TYPE with TYPE. By itself, the END statement stops program execution and closes all files. In a stand-alone program, END returns control to the operating system. When running inside the QuickBASIC environment, END returns you to that environment. The compiler always assumes an END statement at the conclusion of any program, so omitting an END statement at the end of a program still produces proper program termination. You may place END statements anywhere in the program to end program execution.