- The correct title of this article is Item # of () in (). The Scratch Wiki uses this different title because of technical restrictions.
Item Number of () in () is a list block and a reporter block. This block reports the index in a list where an item first appears. If an item appears more than once, it reports the index of the first occurrence of that item. If the item is not in a list, it reports 0.
when gf clicked delete all of [list v] add [a] to [list v] add [b] to [list v] add [c] to [list v] add [b] to [list v] say (item # of [c] in [list v]) //says 3 since c is the third item in the list say (item # of [b] in [list v]) //says 2 since the first occurrence of b in the list is in the second position say (item # of [d] in [list v]) //says 0 since d is not in the list
This can instead be accomplished by looking at each item in a list in order and seeing if any of them equal the item being searched for.
define search list for (search term) set [counter v] to  //the position in the list we are currently looking at set [result v] to  //if we find the item we are looking for, we will store its position here repeat until <<(counter) > (length of [list v])> or <not <(result) = >>> //exit the loop if we either have found the item we are looking for or we have looked at every item in the list and not found it if <(item (counter) of [list v]) = (search term)> then set [result v] to (counter) //if the item at the position we are currently looking at is equal to what we are looking for, then store the current position as the result else change [counter v] by  //otherwise, look at the next position end end