Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A Question on Calls to Subroutines
#9
(11-23-2023, 01:28 PM)Dimster Wrote: 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?
Why don't you try it?

[Image: I-say-Captain-2023-11-25.jpg]

He said captain
I said wot

He said captain
I said wot

He said captain
I said wot

He said captain
I said wot d'ya want  Tongue

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 Kernelpanic - 11-25-2023, 09:18 PM



Users browsing this thread: 2 Guest(s)