Program flow etc.

BlitzMax Forums/BlitzMax Beginners Area/Program flow etc.

Kemi(Posted 2006) [#1]
Some (stupid) basic questions:

I assume I have to put all functions at the beginning of my code and the "main" program at the end. Is that because the compiler wouldn't recognize declared variables etc. otherwise?

Am I right to assume that I can also define a global variable inside a function and then also use it in the "main" part of the code? Or do I have to define it outside of the function?

These kind of basic things are explained nowhere ...


Dreamora(Posted 2006) [#2]
Functions: Its unimportant where you place them if they are within the same file. BM does not need to see the declaration upfront to know it exists

Global: globals must be defined outside of functions and before you first use them. Globals defined within a function is the same as static in C