![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Questions & Help Needed Post any question regarding Basic4ppc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
Can't a sub return an array ??
Sorry for the short answer, just turning the computer off but saw this question.
__________________
Avoiding lawyers ![]() O2 XDA Artemis Touch Flo 4.02 Full Cube Rom WM6.1 http://www.taximania.net |
|
||||
|
not unless it is declared in globals, as all arrays should be, but we are talking of single local variables...I think...
__________________
Paulo Gomes Porto, Portugal PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD PPC: Qtek9000, 1GB SD |
|
|||
|
Quote:
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 |
|
||||
|
Quote:
Quote:
![]() specci48 |
|
||||
|
Quote:
I seem to be missing the point of the original question. I know of no computer language that can return more than one result from a function. |
|
||||
|
The easiest way to return more than one value is to hide them in a string....
Return "true,false,26,AnythingElse?" Then you just need to interegate the returned value using string manipulation. Regards, RandomCoder
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD. Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD. "Defeat never comes to any man until he admits it."Josephus Daniels |
|
||||
|
Quote:
![]() That's true, but in most "modern" languages the "one" result can be an object which contains several different information. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| All hail GeoTrail's return | RandomCoder | Chit Chat | 1 | 02-17-2008 12:14 PM |
| Return value from Form | ghislain | Questions & Help Needed | 5 | 12-23-2007 07:34 AM |
| return issue | Cableguy | Questions & Help Needed | 1 | 09-21-2007 06:01 AM |