1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-01 15:00:38 +00:00
QB64-PE/internal/help/CLEAR.txt

40 lines
1.2 KiB
Plaintext
Raw Normal View History

2017-10-10 14:55:21 +00:00
The [[CLEAR]] statement clears all variable and array element values in a program.
2017-10-10 14:55:21 +00:00
{{PageSyntax}}
: [[CLEAR]] [, {{Parameter|ignored&}} , {{Parameter|ignored&}}]
{{PageDescription}}
2017-10-10 14:55:21 +00:00
* All parameters are optional and ignored by '''QB64'''.
2019-04-15 01:15:33 +00:00
* Normally used to clear all program variable and [[Arrays|array]] values where numerical values become zero and string values become empty ("").
* It does not clear [[CONST|constant]] values.
2017-10-10 14:55:21 +00:00
* Closes all opened files.
* [[$DYNAMIC]] or [[REDIM]] arrays will need to be [[REDIM|redimensioned]] or an [[ERROR Codes|error]] will occur when referenced because they are removed.
2017-10-10 14:55:21 +00:00
{{PageExamples}}
2016-03-18 11:36:04 +00:00
''Example:'' Using CLEAR to clear array elements from [[STATIC|static]] arrays or arrays created using [[DIM]].
{{CodeStart}} '' ''
{{Cl|CLS}}
{{Cl|DIM}} array(10) 'create a {{Cl|$STATIC}} array
array(5) = 23
{{Cl|PRINT}} array(5)
{{Cl|CLEAR}}
{{Cl|PRINT}} array(5) '' ''
{{CodeEnd}}
2019-04-15 01:15:33 +00:00
:''Note:'' If you change DIM to REDIM a "Subscript out of range" error will occur because a [[$DYNAMIC]] array is removed by CLEAR.
{{PageSeeAlso}}
2017-10-10 14:55:21 +00:00
* [[ERASE]]
* [[REDIM]], [[_PRESERVE]]
2016-03-18 11:36:04 +00:00
* [[Arrays]], [[&B|_BIT arrays]]
2019-04-15 01:15:33 +00:00
{{PageNavigation}}
<