Shared

Syntax

Shared <variable> [,<variable>,...]

Description

Shared allows a variable to be accessed within a procedure. If you want to access an array you must use the name of the array without the brackets.

Example :

a.l = 10
Dim array.w(8)

Procedure Change()
  Shared a
  Shared array
  a = 20 
  array(0) = 5
EndProcedure 

If OpenConsole()
  Change()
  PrintN(Str(a)) ; Will print 20, as the variable has been shared.
  PrintN(Str(array(0))) ; Will print 5, as the array has been shared.
  Input()
  CloseConsole()
EndIf
End