Really? If you have something like this:
Function FindItem(Input as someClass(), lookingFor as string, ByRef Name as String, ByRef Location as String) as Boolean
…you get calling code that looks like this:
Dim FoundName as String
Dim FoundLocation as String
If FindItem(theInput, "Pineapple", FoundName, FoundLocation) Then
ProcessItem(FoundName, FoundLocation)
End
…plus you get AutoComplete that specifies exactly what each variable will return.
If you do the array return, you have:
Function Function FindItem(Input as someClass(), lookingFor as string) as String()
The calling code has an ambiguous return value, could be nil or an empty array; plus you have to remember (or create constants for) the item indices:
Dim FoundItems() as String
FoundItems=FindItem(theInput, "Pineapple)
If FoundItems<>nil and Ubound(FoundItems)=1 Then
ProcessItems(FoundItems(0), FoundItems(1))
End
AutoComplete doesn’t give you any contextual understanding of what the return value is going to be, just a string array.
It’s a matter of style, of course, because both approaches will work given they are properly implemented and utilized. I prefer the ByRef approach because it produces code that is more explicit about return values, and it provides a non-overloaded indication of whether the function call was successful.
Perhaps we have different notions of the problem.