Version 2.7 Warning #9

Rusty

Well-Known Member
Licensed User
Longtime User
I am receiving very many unused variable (warning #9) warnings
I've checked each of these and find that the variables are definitely used.
For example:
B4X:
    Dim ThisHeight As Int = rc.Height
    If rc.Height < 1 Then                 'in case the height wasn't set
        rc.Height = RowHeight
        ThisHeight = RowHeight + 20
    End If
The variable ThisHeight is flagged as unused. Can you explain?
Thanks,
Rusty
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
This warning means that the variable is only assigned a value. It is never used. You can delete this variable (and the places it is assigned values) and everything will work.

Note that the very useful "Find all references" tool can help you diagnose this situations. Click on the variable and press F7. You will see that this variable is only assigned.
 
Top