11-23-2023, 01:42 PM
In QuickBASIC and QBasic, this program must work, and it does. "B" is declared silently by the interpreter/compiler AS SINGLE.
Add OPTION _EXPLICIT at the top and it becomes a QB64 program that won't compile, for the reason you have provided. The "B" inside the subprogram is not the same as the "B" in main-level code. You could see this for yourself, changing the places of "TestB" subprogram call with printing out the global variable "B".
Add OPTION _EXPLICIT at the top and it becomes a QB64 program that won't compile, for the reason you have provided. The "B" inside the subprogram is not the same as the "B" in main-level code. You could see this for yourself, changing the places of "TestB" subprogram call with printing out the global variable "B".