QB64.com

QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

The CLEAR statement clears all variable and array element values in a program.

Syntax

CLEAR [, ignored& , ignored&]

Description

Example(s)

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.

See Also