B4J Question Sub argument flagged as unused

Nandosta

Member
Hello everybody, I'm probably missing the obvious thing so I need your eyes for this.
I'm getting the "Unused variable" (#9) warning for "par2" on declaring the sub in following code:

B4X:
Sub sub2(par1 As String, par2 As String)
       
    par2 = "(" & par1 & ")"
       
End Sub

And indeed, par2 returns no value. Any idea why?
Complete code below.

B4X:
Sub AppStart (Args() As String)
   
    Dim xText As String
    xText = sub1("abc")    ' Call sub1 as function
    Log("sub1 = " &  xText)
   
    Dim xText As String
    sub2("abc", xText)     ' Call sub2 as sub
    Log("sub2 = " & xText)
   
End Sub

Sub sub1(par1 As String) As String
   
    Return "[" & par1 & "]"
   
End Sub

Sub sub2(par1 As String, par2 As String)
   
    par2 = "(" & par1 & ")"
   
End Sub


(Platform W10 64-bit, B4J 9.10)
 
Top