Reputation: 843
I am a newbie in programming. I was doing practise on some VB code but i got that error mentioned on the subject.
Here are the codes
Function hypotenuse(ByVal a As Single, ByVal b As Single) As Single
Return Math.Sqrt((a ^ 2 ) + (b ^ 2))
End function
The error is highlighted at the return expression "Math".
Upvotes: 0
Views: 52
Reputation: 743
In VB6/VBA, return value variable name of a function is the function name itself.
Function hypotenuse(ByVal a As Single, ByVal b As Single) As Single
hypotenuse = Math.Sqr((a ^ 2) + (b ^ 2))
End Function
Upvotes: 2