Sub MenuList_Click (returnName As String)
Dim Number1 As Double = 3
Dim Number2 As Double = 5
Dim Operation As String = "sum"
Log(Operation = "sum") 'return sum
Log(Operation = "subtract") 'return subtract
Log(MyFunction(Number1, Number2, Operation = "sum")) 'return 8
Log(MyFunction(Number1, Number2, Operation = "subtract")) 'return 8
End Sub
Sub MyFunction(a As Double, b As Double, Operation As Boolean) As Double
Dim Result As Double
If Operation Then
Result = a + b
Else
Result = a - b
End If
Return Result
End Sub