1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-06-29 10:30:36 +00:00
QB64-PE/internal/help/OPTION__EXPLICIT.txt
SteveMcNeill 33adc04fc4 Add temp folder to repo. It's necessary as well!
Just more initial setting on... nothing much to see here.
2022-04-28 13:39:56 -04:00

43 lines
1.3 KiB
Plaintext

{{DISPLAYTITLE:OPTION _EXPLICIT}}
[[OPTION _EXPLICIT]] instructs the compiler to require variable declaration with [[DIM]], [[REDIM]] or an equivalent statement.
{{PageSyntax}}
: [[OPTION _EXPLICIT]]
{{PageDescription}}
* With [[OPTION _EXPLICIT]] you can avoid typos by having QB64 immediately warn in the '''Status area''' of new variables used without previous declaration.
* Enable [[OPTION _EXPLICIT]] temporarily even if a program source file doesn't contain the directive by specifying the '''-e''' switch when compiling via command line (''qb64 -c file.bas -e'').
{{PageErrors}}
* If used, [[OPTION _EXPLICIT]] must be the very first statement in your program. No other statements can precede it (except for [[$NOPREFIX]] or comment lines started with an [[Apostrophe|apostrophe]] or [[REM]]).
* Do not use [[OPTION _EXPLICIT]] in [[$INCLUDE]]d modules.
{{PageExamples}}
''Example:'' Avoiding simple typos with [[OPTION _EXPLICIT]] results shown in the QB64 IDE Status area.
{{CodeStart}}{{Cl|OPTION _EXPLICIT}}
{{Cl|DIM}} myVariable {{Cl|AS}} {{Cl|INTEGER}}
myVariable = 5
{{Cl|PRINT}} myVariabe
{{CodeEnd}}
''QB64 IDE Status will show:''
'''Variable 'myVariabe' (SINGLE) not defined on line 4'''
{{PageSeeAlso}}
* [[OPTION _EXPLICITARRAY]]
* [[DIM]], [[REDIM]]
* [[SHARED]]
* [[STATIC]]
{{PageNavigation}}
<