@Raptor88
here link of rules:
http://www.qb64.org/wiki/DIMhttp://www.qb64.org/wiki/SHARED<--- see example two
http://www.qb64.org/wiki/COMMONhttp://www.qb64.org/wiki/COMMON_SHAREDand here a good academic lesson
https://www.youtube.com/watch?v=JqpgyumdBG8<--- see at 00.41
I'll try to be more clear with my words...
1. if you use only GOSUB the variables declared into main are global and accessible from any block of GOSUB you try to access them.
2. if you use only SUB/FUNCTION the variables declared into main are global and accessible from SUB/FUNCTION in 3 ways :
1. DIM SHARED (or COMMON SHARED if you use more than one module of Qbasic ) in the main
2. DIM (or raw declaration by name with suffix for the type of data) in the main and SHARED with same name in each SUB/FUNCTION where it is accessed
3. DIM (or raw declaration by name with suffix for the type of data) in the main and declaration of the variable into the declaration of the SUB/FUNCTION as parameter.
So yes global are those in the main, the closed block of code SUB/FUNCTION can access to the main in one of the three ways
and the second is this your response...
Without SHARED, then the variables are not seen within SUBs.
if you use GOSUB into SUB/FUNCTION, in QB64 this case is managed like a main with its GOSUB block, in fact you cannot jump with GOSUB or GOTO into or out a SUB/FUNCTION,
so a GOSUB inner to a SUB/FUNCTION can access to local variable of SUB/FUNCTION and plus to all global variables of the main using one of the three previous methods....
So it is build Qbasic/QB64!
Thanks to read and thanks for feedback