Discuss Scratch

FoolsGuld
Scratcher
100+ posts

How many of one item are in a list

Is there an easy way to tell how many times a certain item occurs in a list?
Spentiline
Scratcher
100+ posts

How many of one item are in a list

define count occurrences of (item)
set [output v] to (0)
if <[list v] contains (item)> then
set [i v] to (0)
repeat (length of [list v])
change [i v] by (1)
if <(item (i) of [list v]) = (item)> then
change [output v] by (1)
end
end
end
FoolsGuld
Scratcher
100+ posts

How many of one item are in a list

Ok, thanks

Powered by DjangoBB