Sign in to follow this  
Followers 0
qwertylol

more than one return

6 posts in this topic

is it possible to return more than one information?

I need both $checksum and 1or 2 to return.

Share this post


Link to post
Share on other sites



is it possible to return more than one information?

I need both $checksum and 1or 2 to return.

Return $Whatever & $Whatever1 & $Whatever2

Share this post


Link to post
Share on other sites

is it possible to return more than one information?

I need both $checksum and 1or 2 to return.

Or have your function create

Local $_TmpArray[2]=[$checksum,1]

and at the end, use

Return $_TmpArray

then your script can check $_TmpArray[0] for $checksum and $_TmpArray[1] for the 1 or 2 value.


"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Or if you only want to return one extra value that's always a number, you could use @extended.

Something like

Func T($checksum)
  SetError(0, 2)
  Return $checksum
EndFunc

$return = T(23)

MsgBox(0, @extended, $return) ; Should give you 2, and 23
Edited by Saunders

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

You can also use the ByRef option to return values from a function:

Dim $i_Checksum1, $i_Checksum2
DoTheChecksum($i_Checksum1, $i_Checksum2)
Msgbox(0,"Checksums","Checksum 1="&$i_Checksum1&@CRLF&"Checksum 2="&$i_Checksum2)

Func DoTheChecksum(ByRef $i_Check1, ByRef $i_Check2)
    $i_Check1 = 20
    $i_Check2 = 30
    Return 1;Success
EndFunc

This means that the parameters that are input into the function are actually modified by the function to return a value that you want. The $i_Check1 variable is essentially a pointer to the $i_Checksum1 value. Any modification made to $i_Check1 inside the function will be made to $i_Checksum1 as well.

-The Kandie Man ;-)

Edited by The Kandie Man

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

you guys rules men :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0