Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ARRAY declaration in GOSUB routines.
#1
I have noticed the following.

OPTION _EXPLICIT
[main code]
CALL test
END

SUBROUTINE test
[variable declaration]
[arrays declaration]
[CODE in which arrays are not used]
GOSUB section 1
[CODE]
section 1:
'[variable declaration]
'[arrays declaration]
[CODE in which arrays are used]
RETURN
END SUB

So, OPTION _EXPLICIT requires the declaration. If not, it get error. However, for it, it's the same that:
[variable declaration]
[arrays declaration]
is put at the beginning of the main code of the subroutine, or at the beginning of the GOSUB routine. The important, for it, is that the declaration takes place before the use of varriable and arrays to be declared.

But I noticed that if I put [arrays declaration] in the main code of the subroutine and not at the beginning of the GOSUB routine, then I have an OUT OF RANGE error executing the program with the reference to the lines in which the arrays are used.

Why?

The GOSUB routines, regardless if they are used in the main code or in a suroutine, are not considered as a part, respectively, of the main code/subroutine?
Reply


Messages In This Thread
ARRAY declaration in GOSUB routines. - by bartok - 02-04-2024, 01:05 PM



Users browsing this thread: 2 Guest(s)