How to compare two list?

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
Map canvas
Method Inspector

1 Like

@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.

1 Like

Here’s a demo of what @actech described:

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.