Hi !
A bit stuck with it.
Say, I declas Array in the beginning of the prg, like
dim MyArray( ElementsNumber )
Then, I need to make it visible from any Function and/or Psub, like this
Fuction MyFunc( param )
...........
; Sample operation
var1 - Myarray( param )
.............
EndFunction
Is it possible ?
Yes, that array is global because you declared it outside the function.
PlayBASIC is top -> down compiler. Items such as arrays/variables need to be declared prior to their use.
In this sample the Names$() array is visible to all of the code bellow this declaration.
[pbcode]
Dim Name$(100)
SetName(1,"Bill")
Function SetName(Pos,Name$)
Name$(pos)=Name$
EndFunction
[/pbcode]
In this sample names$() isn't visible and will error.
[pbcode]
Function SetName(Pos,Name$)
Name$(pos)=Name$
EndFunction
Dim Name$(100)
SetName(1,"Bill")
[/pbcode]
More Reading See HELP -> ABOUT -> PROGRAMLAYOUT (http://playbasic.com/help.php?page=ABOUT.PROGRAMLAYOUT)