Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Function

Status
Not open for further replies.

Albano

Instructor
Dec 11, 2000
221
PT
Help, I need to know if it´s possible to make a function that return more then one value, and how it´s dune.

Thanks in advance,

Albano
 
There are several ways to do what you want:
1. You can declare a user data type consisting of several values, and return that from the function.
2. You can return a Variant that contains an array.
3. You can modify the values of several "ByVal" arguments (this is called a "side effect" of the function; programmers will curse you unless you document it well)
4. You can modify the values of several global variables (another side effect)

What you can't do is return several values and use them in an expression that contains the function call. Mathematical formulas can't contain terms with multiple values, and programming language expressions are based on math. What, after all, would "a + Func(b)" mean if Func(b) returned multiple values? Which value would be added to 'a' in evaluating the expression? It's a totally foreign concept. Rick Sprague
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top