# Directives

EDIT | Edit Line in Program

## Formats

1. | Edit: | EDIT stmtref {D[string] | C[string] | R[string] | [string]}
2. | Edit Using Back Apostrophe: | `stmtref {D[string] | C[string] | R[string] | [string]}

#### Note:
The square brackets above are part of the statement's syntax.

Where:

` | Back Apostrophe. PxPlus accepts this as a substitute for typing EDIT.
[string] | Add. String literal to add to the statement.
C[string] | Copy. String literal contains the final character(s) of string to be copied.
D[string] | Delete. String literal contains the final character(s) of the string to be deleted.
R[string] | Replace. String literal is the new text to replace the existing string.
stmtref | Program line number or statement label to which to transfer control.

#### Note:
The EDIT directive is used in Command mode.

## Description

Use the EDIT directive to change an existing statement in a program. PxPlus builds a new statement based on the commands you use in the EDIT directive. The new statement then replaces the existing one, unless you change the line number. (In the latter case, the original statement remains in the program at the original line number, and the new or resultant statement is added to the program at the new line number.) If you do not include parameters following the statement reference, PxPlus displays the specified line so that you can edit it directly using the keyboard.

Four options are available in the EDIT directive:

Delete text from statement | Use the D option to scan along the original statement up to and including the given string without copying the data to the new statement. The result omits the deleted portion of the string from the new statement.
Copy text from current statement to the new statement | Use the C option to scan along the original statement from the cursor up to and including the given string, copying the data to the new statement.
Replace text from current line in the new statement | Use the R option to append the given string to the new statement while advancing over the corresponding number of characters in the original statement.
Add text to the new statement | This option adds the given string to the new statement.

After all options have been processed, any remaining portion of the original statement is appended to the new statement.

## Example

0200 let A=4*M; print "ANSWER =",A
edit 200 C[=] D[*] C[A] R[nswer] [ now]
After EDIT:
0200 let A=M; print "Answer now =",A