Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Permitted entries for Common Shared
#5
(11-24-2023, 08:34 AM)PhilOfPerth Wrote: I'm using it to share variables between the Main and Subroutines, as I often have done - I thought that was the main purpose of this. Wrong again?
Use DIM SHARED instead, that will make all your variables global by being shared everywhere.

If you just want to share a variable with a subroutine/function then you can do this:

DIM Test%

SUB MySub()
    SHARED Test%
   ... your code here
END SUB

Test% will be local to the main code and SHARED with the MySub() subroutine.

I have a complete explanation of this in Lesson 6 here in the tutorial.
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply


Messages In This Thread
RE: Permitted entries for Common Shared - by TerryRitchie - 11-24-2023, 03:02 PM



Users browsing this thread: 1 Guest(s)