Difference between revisions of "COMMON"

From QB64 Wiki
Jump to navigation Jump to search
imported>Cyperium
imported>Cyperium
Line 1: Line 1:
 
COMMON makes the variables or block of variables available to a different module.
 
COMMON makes the variables or block of variables available to a different module.
 +
  
 
''Syntax:'' COMMON [SHARED] [/blockname/] variablelist  
 
''Syntax:'' COMMON [SHARED] [/blockname/] variablelist  
 +
 +
  
 
[[SHARED]] makes the variables shared within the subs and functions within that module.
 
[[SHARED]] makes the variables shared within the subs and functions within that module.
 +
  
 
/blockname/ gives the ability to name a block of variables (ex. COMMON /thename/ a, b, c), this name can later be referenced in the module to only give access to those variables. As such many COMMON statements can be issued with different names to be shared in different modules.
 
/blockname/ gives the ability to name a block of variables (ex. COMMON /thename/ a, b, c), this name can later be referenced in the module to only give access to those variables. As such many COMMON statements can be issued with different names to be shared in different modules.
 +
  
 
variablelist is the variables that should be made available separated by commas.
 
variablelist is the variables that should be made available separated by commas.
 +
  
 
Remember to keep the variable ''order'' the same in both modules as it is the order that matters and not the variables names.
 
Remember to keep the variable ''order'' the same in both modules as it is the order that matters and not the variables names.
 +
  
 
COMMON must be called before any executable statements.
 
COMMON must be called before any executable statements.
 +
  
 
[[COMMON SHARED]] is most commonly used, as then you don't need to share them seperately in the module.
 
[[COMMON SHARED]] is most commonly used, as then you don't need to share them seperately in the module.
 +
  
  
  
 
''See:'' [[COMMON SHARED]]
 
''See:'' [[COMMON SHARED]]

Revision as of 02:39, 11 December 2009

COMMON makes the variables or block of variables available to a different module.


Syntax: COMMON [SHARED] [/blockname/] variablelist


SHARED makes the variables shared within the subs and functions within that module.


/blockname/ gives the ability to name a block of variables (ex. COMMON /thename/ a, b, c), this name can later be referenced in the module to only give access to those variables. As such many COMMON statements can be issued with different names to be shared in different modules.


variablelist is the variables that should be made available separated by commas.


Remember to keep the variable order the same in both modules as it is the order that matters and not the variables names.


COMMON must be called before any executable statements.


COMMON SHARED is most commonly used, as then you don't need to share them seperately in the module.



See: COMMON SHARED