L lamsri799 Member Licensed User Longtime User May 5, 2015 #1 example I have a variable B1 = 20 B2 = 50 B3 = 10 how to sorting variable result is B3 B1 B2 thank you
example I have a variable B1 = 20 B2 = 50 B3 = 10 how to sorting variable result is B3 B1 B2 thank you
M Mahares Expert Licensed User Longtime User May 6, 2015 #2 You can add them to a list, then sort the list. See code below: Code: Copy 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 Upvote 0
You can add them to a list, then sort the list. See code below: Code: Copy 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