Hello World! I want to iterate through an array,and apply something to all objects expect one,how do i do so?thanks in advance.
Simple, just use an if statement with continue
inside your loop:
for (int i = 0; i < theArray.Length; i++) {
var element = theArray[i];
if (/* some condition */) {
// skip this one
continue;
}
// The rest of your code
}
1 Like