I need help with the logic of a script I'm working on. I have no code as of yet to post but what I want to do is read in an array of values like 1 2 4 5 2 1 5 6 7 1. From this the script would loop through each value and do something and if it encountered the same value again in the array do something else. For example using the above array 1=do something, 2=do something, 4=do something, 5=do something, 2=do something else, 1=do something else, 5=do something else etc. Can anyone help me in this logic of this loop. Thanks