Delete list how I can

How do I check and delete an empty list [] or sublist [a, b, c, []]? Thanks

Check and delete from where?

If you want to delete internal empty lists from a list, you could use this code ...

for n = length(inputList)  to 1 by -1
   if is empty list(select item n from list inputList) then
      remove item n from list inputList
end for

Note the backwards traversal. It is necessary because the item numbers collapse as you remove items.

2 Likes

sory Im try in app inventor 2. I appreciate it very much, thank you

Try like this

3 Likes

You can simply set a List as empty (first is a Blocks List, second a ListView):

Snap1

That doesn't need to be a button click event, you can pop the code anywhere you need to.

You can also make a ListView invisible:

Snap2

2 Likes