forked from QB64-Phoenix-Edition/QB64pe
-
Notifications
You must be signed in to change notification settings - Fork 0
CLEAR
Samuel Gomes edited this page Nov 8, 2022
·
1 revision
The CLEAR statement clears all variable and array element values in a program.
CLEAR [, ignored& , ignored&]
- All parameters are optional and ignored by QB64.
- Normally used to clear all program variable and Arrays values where numerical values become zero and string values become empty ("").
- It does not clear CONST values.
- Closes all opened files.
- $DYNAMIC or REDIM arrays will need to be REDIM or an ERROR Codes will occur when referenced because they are removed.
Using CLEAR to clear array elements from STATIC arrays or arrays created using DIM.
CLS
DIM array(10) 'create a $STATIC array
array(5) = 23
PRINT array(5)
CLEAR
PRINT array(5)
Note: If you change DIM to REDIM a "Subscript out of range" error will occur because a $DYNAMIC array is removed by CLEAR.