Functions - How do you return more than one variab

Thread: Functions - How do you return more than one variab

1. Senior Member
Join Date
Dec 1969
Posts
294

Functions - How do you return more than one variab

Say you have a function like this<BR><BR>Function test(anumber)<BR> testnumber=0<BR>End Function<BR><BR>You can say the following to get the result of the function<BR><BR>variable=test<BR><BR>But, what if you had this<BR><BR>Function test(anumber)<BR> result1=12<BR> result2=34<BR> result3=76<BR>End Function<BR><BR>How do you get all these values out of the function?

2. Senior Member
Join Date
Dec 1969
Location
Los Angeles, CA
Posts
21,192

RE: Functions - How do you return more than one va

Well there are a lot of ways<BR><BR>make sure the variables are not function level but page level <BR>OR<BR>return an array<BR>OR<BR>assign them to variables that are passed to the function<BR>OR<BR>..<BR>

3. Senior Member
Join Date
Dec 1969
Posts
294

RE: Functions - How do you return more than one va

I haven&#039;t a clue what you mean by the first one. Could you give me an example takeing the example function I gave?

4. Senior Member
Join Date
Dec 1969
Location
Los Angeles, CA
Posts
21,192

RE: Functions - How do you return more than one va

Dim VivaldiKills<BR>Dim VivaldiDrinksBlood<BR><BR>function VivaldiIsADrunk()<BR>VivaldiKills = "furry animals"<BR>VivaldiDrinksBlood = "of harmless animals"<BR>end function<BR><BR><BR>so when you call this function the values of BOTH the variables will be available everywhere in your form AFTER you call the function<BR><BR>

5. Senior Member
Join Date
Dec 1969
Posts
294

RE: Functions - How do you return more than one va

Thanks. I didn;t realise that was the case, might explain some strange things which are happening in my code!

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•