Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Sub and Value Return

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-04-2010, 07:27 PM
Junior Member
 
Join Date: Sep 2009
Posts: 18
Post Sub and Value Return

Maybe stupid question but I did not find out way how to return more then one parameter from Sub. I would like to do something like this:

Sub MinMax (array(), array_max_index, min_index, max_index, min_value,
max_value)

min_value=array(0)
max_value=array(0)
min_index=0
max_index=0
For i=0 To array_max_index
If array(i)<min_value Then
min_value=array(i)
min_index=i
Else If array(i)>max_value Then
max_value=array(i)
max_index=i
End If
Next
End Sub

When I run this kind of code values for min,max values and indexes are not returned. In C language the values I want to return should be called by addresses with & symbol. Is there any way how to do it in Basic4PPC?

thnx
Reply With Quote
  #2 (permalink)  
Old 01-04-2010, 07:38 PM
taximania's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Location: Derbyshire. UK
Posts: 592
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Use Global variables.
I believe returns from subs are limited.
__________________
.
.
.
Don't ask, I'm fine, honest. !!
.
.
.
Just a little crazy at times



O2 XDA, GW Evo 2.1 UC WWE Rom, WM6.1
Radio Ver 03.34.90
With Basic4ppc V6.80


http://www.taximania.co.uk

Last edited by taximania : 01-04-2010 at 07:46 PM.
Reply With Quote
  #3 (permalink)  
Old 01-04-2010, 09:22 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 4,463
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

Unfortunately you can't do what you want to do in B4PPC yet.
You cannot pass variables by reference to a sub routine and back.
You can only return a value, or you could have a look here: http://www.basic4ppc.com/forum/basic...ub-return.html

Hopefully it would come in the next version.

Best regards.
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide
Reply With Quote
  #4 (permalink)  
Old 01-04-2010, 09:57 PM
Junior Member
 
Join Date: Sep 2009
Posts: 18
Default

Quote:
Originally Posted by taximania View Post
Use Global variables.
I believe returns from subs are limited.
I know I can use Global variables, but using Global variables is "Way to Hell", because your Subroutines are limited in reusability at least naming of variables should be the same then. I hope guys behind this product will work on this. How do you cope with this? Using Global Vars or using Arrays or Stack?
Reply With Quote
  #5 (permalink)  
Old 01-05-2010, 06:47 AM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 4,463
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

I use global variables and global arrays.

Best regards.
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need more structure support - Sub return focusrocker Basic4ppc Wishlist 2 09-20-2009 12:09 PM
Can a sub return more than 1 value ? TWELVE Questions (Windows Mobile) 13 05-28-2008 09:58 AM
All hail GeoTrail's return RandomCoder Chit Chat 1 02-17-2008 12:14 PM
Return value from Form ghislain Questions (Windows Mobile) 5 12-23-2007 07:34 AM
return issue Cableguy Questions (Windows Mobile) 1 09-21-2007 06:01 AM


All times are GMT. The time now is 10:40 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0