Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
scootsullivan
scootsullivan's Profile
1
Posts
3
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
"default" for if statements within for loops
[4 Replies]
10-Jun-2013 08:11 PM
Forum:
Programming Questions
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?
«Prev
Next »
Moderate user : scootsullivan
Forum