Can't a sub return an array ??
I believe it can, but makes no sense in that context because if a variable is global i can access it everytime without the need to return it from a sub.
With a return value you can use your subs as functions/procedures like this:
if ParseMyData(inputstring) = "myexpectedstring" then
or
if DoIHaveMail(value) = true then
Globals make everything work, but i prefer to avoid globals whenever i can - for several known reasons:
- if a variable gets the wrong value i have to look into every sub that's using it
- each variable can only be used one time in the entire code
- subs can't be used as functions
Certainly there are more reasons not to use globals.
The use of the return value as function would also prevent the return of more than one value...if mysub(value) ...condition..then would have more than one parameter and cannot make a decision then.
So the use of an array as return value would be the solution here...if there were not the caveat that every array has to be global in B4P.
Furthermore as far as i remember, there seem to be restrictions if the optimized compiling is used..?
cheers
TWELVE