Example as
List1 = 1,2,3,4
List2 = 4,3,2,1
List3 = 1,2,3,4
List1 != List2
List1 = List3
I want to compare both num and location in list, how do I do this?
Example as
List1 = 1,2,3,4
List2 = 4,3,2,1
List3 = 1,2,3,4
List1 != List2
List1 = List3
I want to compare both num and location in list, how do I do this?
There is no built-in way to compare full lists. Youād have to use a loop to check each item against the other list.
To solve your problem, you need to convert lists to strings (text) and compare strings.
Best regards, Alex
ACtech demo project
Thunkable X Basic Programming Course
Block Reference
Component Reference
Bug tracker
Polipaint
Map canvas
Method Inspector
Performance
@actech Smart! Is there a length limit to strings in Thunkable? I could see that conversion working for a list with small values (1 to 4) but Iām wondering about something that uses longer numbers (1000 to 4000).
I work with lists that consist of several tens of thousands of records and without any problems convert them to strings and vice versa.
Hereās a demo of what @actech described: https://x.thunkable.com/copy/c13472b100564cdf35d3d5a4c28326ff
Do this:
with this, the result of ācompare_lists(List1,List2)ā would be āfalseā, while ācompare_lists(List1,List3)ā would return ātrueā.
The strength of this approach is that lists of different length are immediately reported as not being the same, and that the comparison of elements stops as soon as there is one mismatch. Only in the case of identical lists would all the elements be checked one against one.
Thanks