Sub and Value Return

merli

Member
Licensed User
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
 

klaus

Expert
Licensed User
Longtime User

merli

Member
Licensed User
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?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…