Show/Hide Toolbars

XSharp

Purpose

The BEGIN SCOPE and END SCOPE keyword pairs declare a scope of visibility and lifetime of LOCAL variables.

Syntax

BEGIN SCOPE
  statements
END SCOPE

 

Arguments

statements Code including one or more LOCAL declarations.

Remarks

BEGIN SCOPE...END SCOPE are used within a function/member body to define an area of restricted scope for LOCAL variables. Attempting to use a LOCAL variable that is declared with a BEGIN SCOPE...END SCOPE block outside the scope, results in a compiler error.

 

Example

 

FUNCTION Test() AS VOID
BEGIN SCOPE
LOCAL n AS INT
n++
? n
END SCOPE
// n does not exist here