mcqueccu Expert Licensed User Longtime User Mar 26, 2021 #1 Hi, I need help checking if a number is in the right increasing order. If anyone is a having a function to do this, kindly share Edit: Increasing order and follow each other B4X: Copy 'increasing right order 1,2,3,4,5 45,46,47,48 'Not Increasing in order 1,2,5,6,7 ''<- because 3,4 are missing My values will be coming from a list like the one below, which I will sort first B4X: Copy Dim mList As List = Array(1, 5,3,10,16,43) mList.Sort(True) Log(mList)
Hi, I need help checking if a number is in the right increasing order. If anyone is a having a function to do this, kindly share Edit: Increasing order and follow each other B4X: Copy 'increasing right order 1,2,3,4,5 45,46,47,48 'Not Increasing in order 1,2,5,6,7 ''<- because 3,4 are missing My values will be coming from a list like the one below, which I will sort first B4X: Copy Dim mList As List = Array(1, 5,3,10,16,43) mList.Sort(True) Log(mList)
LucaMs Expert Licensed User Longtime User Mar 26, 2021 #2 Code: Copy Dim OrderOk As Boolean = True For i = 1 to mList.Size - 1 If (mList.Get(i) - mList(Get(i - 1)) <> 1 Then OrderOK = False Exit End If Next Upvote 0
Code: Copy Dim OrderOk As Boolean = True For i = 1 to mList.Size - 1 If (mList.Get(i) - mList(Get(i - 1)) <> 1 Then OrderOK = False Exit End If Next
mcqueccu Expert Licensed User Longtime User Mar 26, 2021 #3 Thank you. That was fast. Working ok Upvote 0