11 - 62 11 - 62
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
ERASE
Instruction
ERASE
• Deletes the array defined by the DIM instruction from memory.
ERASE <array variable> [ <, array variable> … ]
Syntax
array variable
• • • •
Enter the array variable specified by the DIM
instruction.
Examples
ERASE A, B$
• • • •
Deletes array variables A and B$.
Description
• The ERASE instruction deletes the array that was defined by the DIM instruction from
memory.
• The array, which was deleted by the ERASE instruction, can be declared again by the DIM
instruction.
• All data, which was stored in the array deleted by the ERASE instruction, is lost.
• A “Redimensioned array” error occurs if the array is declared again by the DIM instruction
without being deleted by the ERASE instruction.
Program Example
1 ' Deletes by the ERASE instruction and redefines by the same variable name
10 DIM A(99)
20 DIM A(199)
RUN
Redimensioned array in 20
OK
15 ERASE A
LIST
1 ' Deletes by the ERASE instruction and redefines by the same variable name10 DIM A(99)
10 DIM A(99)
15 ERASE A
20 DIM A(199)
OK
RUN
OK
REMARK
See the DIM and CLEAR instructions.