Android Question How can i resolve this warning

Makumbi

Well-Known Member
Licensed User
Longtime User
iam gettting warning in my log
as
B4X:
unused variable d
B4X:
Sub accountprocess (d As String) As ResumableSub
   
    If IsConnectedToInternet= True Then
        Dim SQLQry As String = "DELETE FROM Balances"
        B4XPages.MainPage.SQL.ExecNonQuery(SQLQry)
        DATA
       
    Else
        xui.MsgboxAsync("Error Connecting to the Server Please Check Your Internet Connection Or Load Mbs","Server Error")
       
        't1.Enabled = False
        Return "Check Your Internet Connection"
    End If
End Sub
 
As I see you really don't use "d" so just change the sub to a sub without expecting a b value.
how can i change that because i use even when i process it with this
B4X:
    Dim holdna As String
    Dim rstna As ResumableSub = accountprocess(holdna)
    Wait For(rstna) Complete (Result As String)
it still comes
 
Upvote 0
You would also need to change
[CODE lang="b4x" title="Original code" highlight="1"]Dim rstna As ResumableSub = accountprocess(holdna)[/CODE]
to
[CODE lang="b4x" title="Revised code" highlight="1"]Dim rstna As ResumableSub = accountprocess[/CODE]

Any "unused variable" warning can be cancelled by adding "'ignore" (that is, apostrophe and the word ignore) on the line where it is defined, eg.
[CODE lang="b4x" title="Suggestion" highlight="1"]Sub accountprocess (d As String) As ResumableSub 'ignore[/CODE]
The compiler will simply not issue a warning in this case.

You can also put the line
[CODE lang="b4x" title="Suggestion" highlight="1"]#IgnoreWarnings: 31, 34[/CODE]
with the numbers of the warnings you want to ignore (31 & 34 in this case) in the Project Attributes region - again this just tells the compiler to ignore all warnings of these types.
 
Upvote 0
You can also put the line
[CODE lang="b4x" title="Suggestion" highlight="1"]#IgnoreWarnings: 31, 34[/CODE]
with the numbers of the warnings you want to ignore (31 & 34 in this case) in the Project Attributes region - again this just tells the compiler to ignore all warnings of these types.
A bad idea and extremely sloppy coding. Only ignore warnings if you really have to, but for the most part you don't have to ignore warnings, you just have to fix them.

@Makumbi issue is just a quick 5 second fix that @KMatle has already pointed out.
 
Last edited:
Upvote 0
I entirely agree, Peter Simpson, ignoring warnings is usually not a good idea.
But the question was asked and Erel has provided the facility.
 
Upvote 0
Back
Top