Android Question How to sorting varible

lamsri799

Member
Licensed User
example
I have a variable
B1 = 20
B2 = 50
B3 = 10

how to sorting variable
result is
B3
B1
B2

thank you
 

Mahares

Well Known Member
Licensed User
You can add them to a list, then sort the list. See code below:
B4X:
Dim B1 = 20 As Int
Dim B2 = 50  As Int
Dim B3 = 10  As Int
Dim B() As Int=Array As Int(B1,B2,B3)
Dim MyList As List 
MyList.Initialize
MyList.AddAll(B)
MyList.Sort(True)
For i=0 To MyList.Size-1
    Log(MyList.Get(i))  'displays 10,20,50
Next
 
Top