Last Item In List

What code can I use besides the pop command (I don’t want to remove the item) to know whether or not I’m dealing with the last item in a list? The list is not static, it is dynamic and changes all the time.

One option is a property list, where I can identify the key of the last element in the list. However, the dev team I’m on does not want to go the dictionary route. So, I’m trying to find other options.

I’m not super familiar with the Sensetalk syntax.

You can access the last item in a list without changing the list by just referring to it:

if the last item of myList is "zzz" then put "Done"

Does that answer your question?

No, because we never know what the last item will be.

Hi Stephen,
Can you clarify what you mean by “dealing with the last item in a list?”
You can write the last item in a list:
Put the last item of myList
As Doug showed, you can compare the last item in a list to a known value:
If the last item of myList is myValue then put "Found it!"
You can count the number of items in a list:
Put the number of items in myList

There is also more documentation on lists available here: Lists | EPF Docs

Hope this helps,
Dave

Thanks, you gave me some ideas.