1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-01 13:50:36 +00:00
QB64-PE/internal/help/$STATIC_$111111.txt
Roland Heyder aeb9c0668b Updates help files for use with new Wiki parser (2nd try)
Note: Many files were removed (not yet existing/empty pages). The parser will try to download them on demand and will auto-generate text for missing pages (eg. most _gl pages).
2022-05-21 00:18:31 +02:00

39 lines
1.3 KiB
Plaintext

{{QBDLDATE:05-20-2022}}
{{QBDLTIME:23:16:45}}
The '''$STATIC''' Metacommand allows the creation of STATIC(un-changeable) arrays.
{{PageSyntax}}
::: REM '''$STATIC'''
* QBasic [[Metacommand]]s require a REM or apostrophy (') before them and are normally placed at the start of the main module.
* Static arrays cannot be resized. If a variable is used to size any array, it becomes [[$DYNAMIC]].
* A [[REDIM]] statement has no effect on [[$STATIC]] arrays except perhaps a [[ERROR Codes|duplicate definition error]] at the [[REDIM]] code.
* The array's type cannot be changed once [[DIM]] and a literal value sets the dimensions and element size.
* [[$STATIC]] defined program [[arrays]] cannot be [[REDIM|re-sized]] or use [[_PRESERVE]].
''Example:'' When a variable is used, the array can be resized despite $STATIC. The array becomes [[$DYNAMIC]].
{{CodeStart}}
'{{Cl|$STATIC}}
{{Cl|INPUT}} "Enter array size: ", size
{{Cl|DIM}} array(size) 'using an actual number instead of the variable will create an error!
{{Cl|REDIM}} array(2 * size)
{{Cl|PRINT}} {{Cl|UBOUND}}(array)
{{CodeEnd}}
: ''Note:'' [[DIM]] using a literal numerical size will create a Duplicate definition error.
''See also:''
* [[$DYNAMIC]], [[STATIC]]
* [[Arrays]], [[Metacommand]]
{{PageNavigation}}