Forum Discussion
FICO
1 year agoCommunity Manager
Dear community, in our code we used the function get0 to get the first element. Unfortunately the element we need is not every time the first element. which function do you suggest to find an element
1 Reply
- FICOCommunity Manager
That depends on what information you have on the element you need. If you have a copy of the object that you are looking for you can use
myList.comtains(lookedForElement) to confirm that your lookedForElement is in myList, then use
myList.getFirstElementIndex(lookedForElement) to get the index where it first shows up in the list.
If you don't have the object itself, but instead just information about it, you could iterate through the list and do tests on the elements like this:
for each Element in myList do
{ if it.property = theRightAnswer then print "Found it" }