1
1
Fork 0
mirror of https://github.com/QB64Official/qb64.git synced 2024-07-03 04:11:21 +00:00
qb64/internal/help/OPTION__EXPLICIT.txt

72 lines
5 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{{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 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}}
<center>QB64 IDE Status:</center>
{{CodeStart}}{{text|██|blue}} '''QB64''' _ {{xbox| X }}{{CodeEnd}}
{{TextStart}}  '''File   Edit   View   Search   Run   Options Help''' {{TextEnd}}
{{CodeStart}}┌────────────────────────────────────█{{title|Untitled}}█─────────────────────────────────────────────┐
│OPTION _EXPLICIT {{title|↑|black}}
│ {{text|█|black}}
│DIM myVariable AS INTEGER ▒
│ ▒
│myVariable = 5 ▒
│ ▒
│PRINT myVariabe_ ▒
│ ▒
│ ▒
│ ▒
│ ▒
│ ▒
│ ▒
│ ▒
│ ▒
│ ▒
│ ▒
│ ▒
│ ▒
│ {{title|↓|black}}
{{title|←|black}}{{text|█|black}}▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒{{title|→|black}}│
────────────────────────────────────── Status ──────────────┤{{text|{{Cl|Quick Search Bar|Find[ }} {{Cl|Quick Search list|↕]}}|aqua}}├─┤
│Variable 'myVariabe' (SINGLE) not defined on line 7 │
│ {{title|↑|black}}
│ ▒
│ ▒
│ {{title|↓|black}}
{{CodeEnd}}
{{BlueStart}} '''7:17'''{{BlueEnd}}
{{PageSeeAlso}}
* [[DIM]], [[REDIM]]
* [[SHARED]]
* [[STATIC]]
{{PageNavigation}}