It might look something like this:
for (var i = 1; i <= thisComp.numLayers; i++){
match = false; //assume no layer's position matches
if (i == index) continue; //skip self
if (position == thisComp.layer(i).position){
match = true; // oops - found a layer with same position
break;
}
}
if (match) {
// your "else" stuff goes here
}
I haven't tested it so there may be errors, but it should be close. It assumes that you want to check every other layer in the comp. If you have cameras, lights, or other layers you want to exclude - you'll have to modify the code.
Dan