Hi,
I'm trying to use return to pass the result from a code module back to the main module. I see lots of examples on the side that uses return, but can't find any thing on the side that called the sub to get the value back. Hope that makes sense. Maybe I'm just misunderstanding how return works?
From my Main module -
From my code module, named Calc1 -
Thanks in advance.
I'm trying to use return to pass the result from a code module back to the main module. I see lots of examples on the side that uses return, but can't find any thing on the side that called the sub to get the value back. Hope that makes sense. Maybe I'm just misunderstanding how return works?
From my Main module -
B4X:
Sub btn1_Click
Dim intA As Int
Dim intB As Int
intA=edt1.Text
intB=edt2.Text
Calc1.Add2(intA,intB)
'lbl1.Text= ?
End Sub
B4X:
Sub Add2(int1 As Int,int2 As Int) As Int
Dim intTotal As Int
intTotal=int1+int2
Log(intTotal)
Return intTotal
End Sub
Thanks in advance.