VB.NET 関数では、2 つの方法で値を返すことができます。たとえば、2 つの int 変数をパラメーターとして受け取る "AddTwoInts" という関数があり、それらを加算して値を返す場合、次のいずれかの関数を記述できます。
1) 「戻る」:
Function AddTwoInts(ByVal intOne As Integer, ByVal intTwo As Integer) As Integer
Return (intOne + intTwo)
End Function
2) 「関数 = 値」:
Function AddTwoInts(ByVal intOne As Integer, ByVal intTwo As Integer) As Integer
AddTwoInts = (intOne + intTwo)
End Function
私の質問は次のとおりです。この 2 つに違いはありますか、またはどちらか一方を使用する理由はありますか?