"default" for if statements within for loops
in
Programming Questions
•
4 months ago
I have an if statement within a for loop such as:
- void mousePressed() {
- for (int i = 1; i < objectArray.length; i++) {
- if (dist(mouseX, mouseY, objectArray[i].xpos[objectArray[i].xpos.length - 1], objectArray[i].ypos[objectArray[i].xpos.length - 1]) < thresh) {
- objectArray[i].updatePosition(mouseX, mouseY);
- }
- }
- }
I need something that acts like "default" for a switch, except it works for an if statement within a for loop.
I need the for loop to finish, and if the "if" condition is false for every iteration, then it does something else.
Is there a processing conditional that can do this?
1