Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Return Multiple Values From a UDF
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
00979276
Message ID:
00979821
Views:
12
>George:
>
>RE: Functional Cohesion
>
>Yes, indeed, a given method/procedure/function should do one, and only one, thing. That may not be the same as returning exactly one result, however.
>
>I'm doing some work that involves linear regression, which determines the "best" line to fit through a series of data points. A line is given by the formula
>
Y = A + B * X
>so the definition of this line actually requires two values (A and B), and invoking a routine to perform linear regression should indeed return both values.
>
James,

Returning multiple values isn't necessarily a bad thing if the values are related in some sense. In that case, I'd probably think that returning an object would be the best solution.

I've a simple rule. If you can completely describe what a function/procedure does without a conjunction, then it's cohesive.

What I was trying to get to here was not having a function/procedure do two different things.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform