Click or drag to resize

_Break Function

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

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.08
Syntax
 FUNCTION _Break(
	uValue AS USUAL
) AS USUAL
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 and the LabelJump() function.
Examples
This example installs an error handler code block that uses a _Break() to get to the line immediately after the RECOVER:
X#
FUNCTION Start()
        // Declare "Export Local" for code block
        // efficiency
        LOCAL cbSaveHandler
        LOCAL oError
        // Set up your own error block.  If an error
        // occurs, your error block will invoke a BREAK
        // that will take you to the RECOVER line.
        cbSaveHandler := ErrorBlock({|x| _Break(x)})
        BEGIN SEQUENCE
                USE myfile
                // If error here, the installed code block
                // is executed and the _Break() in it gets
                // you to the line after RECOVER statement
        RECOVER USING oError
                // You will get via the _Break() only if an
                // error occurs that invokes the installed error handler
                ? "Error opening file"
                InKey(0)
                QUIT                // NOTE
        END
        // Restore the default error handler
        ErrorBlock(cbSaveHandler)
See Also