Functions can be called as subs, in other words, without the calling code making use of the parameter; in yet other words, not on the right side of an = sign. I feel a function should know if that is the case. For instance, wouldn't it be nice and elegant if we could write the following?
Function ConcatStrings _
(ByRef s1 As String, ByVal s2 As String, Optional ByVal sSeparator As String = " ") _
As String
ConcatStrings = IIf(s1 = "", s2, s1 & sSeparator & s2)
If I´mASub Then s1 = ConcatStrings ' Don't change the parameter unnecessarily.
End Function
Where I´mASub is something Boolean (a hidden parameter, or a function) that tells the function whether it has been called as a sub. Is there anything like that?