Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A Question on Calls to Subroutines
#4
Thanks MNR..

 so a Dim Shared variable or array, once created will carry a value of zero. That value can not change unless there is a routine or subroutine somewhere in the programs code to change it. IF the variable or array is created locally within a subroutine, shouldn't there be an error for a non exiting entity if the main module tries to use it?

For example

 Dim Shared A As Integer
Print A
Print B
TestB


Sub TestB
    Dim B
    B = 1

End Sub

In the above code only the variable A was created in the main module. The B variable is not created until the subroutine is called. So the command to Print B before it is actually created, shouldn't that trigger an error?
Reply


Messages In This Thread
A Question on Calls to Subroutines - by Dimster - 11-22-2023, 04:43 PM
RE: A Question on Calls to Subroutines - by Dimster - 11-23-2023, 01:28 PM



Users browsing this thread: 4 Guest(s)