While working away on an old piece of code I came across something like this:-
Public Function MyFunc (some parameters) As Single
If some condition Then
MyFunc = calculate some value
Else
MyFunc = MyFunc
End If
End Function
I’m rather hoping to regularise the second leg of that test; would I be right in assuming the returned value is 0.0 if some condition is false?
Yes, for a function with a defined return type then the default return value is the default for that type (0 for numerics etc) just as if the code contained a
Dim MyFunc as Singleat the top.If no type is specified and no value is implicitly returned, then the
Emptyvalue is returned.