Android Question How can i resolve this warning

Makumbi

Well-Known Member
Licensed 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
 

Makumbi

Well-Known Member
Licensed User
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

PJLPJLPJL

Member
Licensed User
You would also need to change
Original code:
Dim rstna As ResumableSub = accountprocess(holdna)
to
Revised code:
Dim rstna As ResumableSub = accountprocess

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.
Suggestion:
Sub accountprocess (d As String) As ResumableSub 'ignore
The compiler will simply not issue a warning in this case.

You can also put the line
Suggestion:
#IgnoreWarnings: 31, 34
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

Peter Simpson

Expert
Licensed User
Longtime User
You can also put the line
Suggestion:
#IgnoreWarnings: 31, 34
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

PJLPJLPJL

Member
Licensed User
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
Top