Xbasic

END, WEND

Syntax

END

END CLASS

END FUNCTION

END IF

END SELECT

END WHILE

END WITH

WEND

Description

The END statement stops script execution; closes all files, indexes, and tables opened by the script; and removes all local variables.

Discussion

It is good practice to place an END statement at the end of every script, although it is not always required. The last line of a script must have an END statement if the next to last line is a label.

WEND is equivalent to END WHILE.

The END FUNCTION, END IF, END SELECT, and END while statements are variations of the END statement. They are used at the end of a user-defined function, an if statement, a SELECT statement, or a while loop, respectively.

You cannot put an END FUNCTION statement inside an IF ... END IF block.
ON ERROR GOTO COULD_NOT_OPEN_TABLE
dim tbl as P
tbl = table.open()
on error goto 0
tbl.enter_begin()
tbl.firstname = "Jon"
tbl.lastname = "Smith"
tbl.enter_end(.t.)
tbl.close()
'must put an END statement here, or else script will continue into the error handling section
END
COULD_NOT_OPEN_TABLE:
    'if you do not specify an argument for error_text_get(), A5 retrieves the last error
    ui_msg_box("Error"," Could not open table. " + error_text_get())
END

See Also