PB wrote:> If you use Global very often (You like it?) it seems to be a bad design of your code
No it's not. I use it for variables that NEVER change, such as appname$ that
holds the name of the running exe.
Isn't another name for a variable that never changes a "Constant"?
Russell
*** Diapers and politicians need to be changed...for the same reason! ***
*** Make every vote equal: Abolish the Electoral College ***
*** www.au.org ***
PB wrote:> If you use Global very often (You like it?) it seems to be a bad design of your code
No it's not. I use it for variables that NEVER change, such as appname$ that
holds the name of the running exe.
Isn't another name for a variable that never changes a "Constant"?
Russell
@Amiga5k not really.
A Constant can't be defined by a variabel, whereas a global can be, and at runtime and stille never change after that, if you like.
And you did say that you would "Never" change it... Just messing with ya here, but there is a subtle difference. It could, however, be useful to allow Constants to be defined initially with a variable - under certain rules of course (such as the example given). But I suppose in that situation you would just use a Global.
Russell
*** Diapers and politicians need to be changed...for the same reason! ***
*** Make every vote equal: Abolish the Electoral College ***
*** www.au.org ***
I'm not sure I see how a constant can be assigned a variable value.
Maybe special constants could be created such as #PB_ProgramFileName, but they would not be real constants. PureBasic would have to do some hidden initial code to assign the value to the Psuedo-Constant. And in such a case there would be no real gain for the programmer or the program over using the Global approach as PB outlined.