Default main function
thinBasic implements a not mandatory "main function" logic.
If script contains a function called TBMain and during the script execution TBMain was not called by direct invocation, thinBasic will execute TBMain automatically.
TBMain is like the "main" function in C programming language.
TBMain template is like the following:
Function TBMain() As Long
Function = <TBMain Return value>
Value returned by TBMain will be used to pass script return code to the calling process or to the operating system.
If script uses APP_SetReturnCode, TBMain return code will have an higher priority over it and will be used instead.
Is TBMain mandatory?
No, it is not mandatory. A script can or can not contains a TBMain function. It is up to programmer to use this feature or not.
I do not like TBMain name. Can I change it?