Public variables

Pantelis

Member
Licensed User
Longtime User
Hi
In beginners guide says
Process global variables are the only "public" variables.

So, if i declare a variable in process_globals like this
B4X:
Dim I as Int
the I is a public variable?
I try to declare, again in process_global, the same variable using
B4X:
Public I As Int
and it gives no error.
Both declarations gives me public variables? Any difference?

What if i use
B4X:
Public I As Int
in globals an not in process_globals?
 

klaus

Expert
Licensed User
Longtime User
Dim is equivalent to Public !

What if i use Public I As Int in Globals ?
It's a Global variable.

Public and Private declarations are important in Class modules. They were introduced when classes were introduced.
If you declare Dim As Int in a Sub Class_Globals Routine it's considered as Public.

Best regards.
 
Upvote 0
Top