If list contains contents of other list


  • Posts: 124
If there an easy way of doing a check to see if one list contains all the contents in another list?
I've got a list of levels I might load and a list of levels I've played. I want to check if the list of played levels contains everything in the list of levels I might load so that I can clear out the list of levels I've played (to stop stufff falling over).

Does the "list X contains X" block work for comparing two lists?


  • *
  • Posts: 2644
If you want to check that list A contains all the contents of list B, then loop through every item in list B. If any item in list B is not contained in list A, then return "false". If the loop terminates, return "true".