Android Question How to use return between modules?

edm68

Member
Licensed User
Longtime User
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 -
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
From my code module, named Calc1 -
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.
 

edm68

Member
Licensed User
Longtime User
Thank you so much, that worked. I've been searching all weekend for this.
I guess since the examples I saw put a variable after Return, I thought I should look for that? So I put 'intTotal' after Return and that is what I was trying to look for.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…