Probably not the shortest approach, but I’d probably do either this… function countItemRepsInList pList, pItem replace comma with cr in pList filter pList with pItem return (the number of lines in pList) end countItemRepsInList
or this function countItemRepsInList pList, pItem put 0 into tCount repeat for each item tItem in pList if (tItem = pItem) then add 1 to tCount end repeat return tCount end countItemRepsInList Terry From: use-livecode <use-livecode-boun...@lists.runrev.com> on behalf of Roger Guay via use-livecode <use-livecode@lists.runrev.com> Date: Friday, 24 May 2024 at 12:09 PM To: How to use LiveCode <use-livecode@lists.runrev.com> Cc: Roger Guay <i...@mac.com> Subject: Return Total of a Given Repeated Number in a List Hi all, Please, what’s the easiest way to return the total number of a given repeated number in a list of numbers? IOW, how many times is 2 repeated in a list containing 1,2,3,2,4,2,5,2,8 etc. Appreciate your help. Thanks, Roger _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode