Product Information > JADE Development Environment User’s Guide > Chapter 4 - Defining Methods, Properties, Constants, and Conditions > Declaring an Unknown Local Identifier as a Local Variable

Declaring an Unknown Local Identifier as a Local Variable

When editing a JADE method, you can declare an unknown local identifier as a local variable.

To declare a local identifier as a local variable

  1. Position the cursor on the identifier.

  2. Right-click and then select the Declare Local Variable command from the Refactor submenu of the Edit menu.

  3. If the identifier is assigned by an expression or it is used as an assignment value, the type of the local variable is determined from that expression.

If the type cannot be determined or it is not an assignment expression, a dialog is displayed. In the Variable Type combo box, select the type of the local variable and then click the OK button.

Text in the status line displays the result of the action; for example:

Local variable docExample : String was added to the method vars

A local variable of the determined or selected type is added to the vars section of the method, which is created if it does not exist. The cursor remains at its previous position.

Examples of an unknown indx local identifier in a method are as follows.

indx := 0;

posn := indx;

Positioning the cursor over indx, where this is undefined, would result in the following code fragment.

vars
...
indx : Integer;
begin
...