Usage of "is a list" and "is list empty"

Hi, I would like to know the different usage of "is a list" and "is list empty".
It seems there are circumstances where "is list empty" cannot be used when checking if a list exists.

Thank you.

from the documentation http://ai2.appinventor.mit.edu/reference/blocks/lists.html

is a list?

If thing is a list, returns true; otherwise, returns false.

is list empty

If list has no items, returns true; otherwise, returns false.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

To simplify it -
is a list is used to check if the given value, (a variable or something from a database or any other input) is a list or not and returns -

is list empty is used to check if the given value, (a variable or something from a database or any other input) is a an empty list or not and returns -

OR maybe I just complicated it... :sweat_smile:

Here is an experiment for you.

Apply the block "is list empty" to a blank text block.
What is the result?

Apply the block "is list empty" to a variable holding blank text value.
What is the result?
Capture

My experience is that even if a variable is not a list, "is a list" can still return true. Is this correct?

No, but how about you show us an example of your experience.

What does an empty list mean? There is a tag but no value(" ")?

Sorry, please ignore my earlier question. I think I confused list with storage in TinyDB or TinyWebDB.

image

This is what I meant

1 Like

Thanks to all.

Hi Anke, I tried experimenting with the list components again and I couldn't find anything which is in contradiction to your statement. Thank you🤣

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.