Click or drag to resize

_Break Function

X#
Branch out of a BEGIN SEQUENCE...END construct.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax
 FUNCTION _Break(
	uValue AS USUAL
) AS USUAL
Request Example View Source

Parameters

uValue
Type: Usual
The value passed to the RECOVER clause. Note that uValue is not optional; however, NIL can be specified if there is no break value.

Return Value

Type: Usual
The value passed to the RECOVER clause.
Remarks
_Break() is identical in functionality to the BREAK statement
Examples
This example installs an error handler code block that uses a _Break() to get to the line immediately after the RECOVER:
X#
 1FUNCTION Start()
 2    // Declare "Export Local" for code block
 3    // efficiency
 4    LOCAL cbSaveHandler
 5    LOCAL oError
 6    // Set up your own error block.<br />
 7If an error
 8    // occurs, your error block will invoke a BREAK
 9    // that will take you to the RECOVER line.
10    cbSaveHandler := ErrorBlock({|x| _Break(x)})
11    BEGIN SEQUENCE
12        USE myfile
13        // If error here, the installed code block
14        // is executed and the _Break() in it gets
15        // you to the line after RECOVER statement
16    RECOVER USING oError
17        // You will get via the _Break() only if an
18        // error occurs that invokes the installed error handler
19        ? "Error opening file"
20        InKey(0)
21        QUIT        // NOTE
22    END
23    // Restore the default error handler
24    ErrorBlock(cbSaveHandler)
See Also