int and adding

Cor

Active Member
Licensed User
Longtime User
dim selectedString as int

selectedString=1

selectedString = selectedString +1

result as 2.0

so

if selectedString =7 will never fire up

if selectedString =7.0 will work

However is you passing it on sub it wil have the right value

Sub DrawStringColor(selString As Int)

so if you out it into another variable then it will work ok

selString shows 7


grCor
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Are you sure that you declared selectedString As Int when you ran it?
It should have work correctly.

The problem happens when you use Strings instead of numbers. This problem is fixed for the next update (though it is still recommended to correctly declare the numeric variables).

BTW, it is difficult to read posts with code and text together. You can use the {code} {/code} tags to make it clearer (it should be square brackets instead of the round brackets):
B4X:
dim selectedString as int

selectedString=1

selectedString = selectedString +1
 
Top