Reputation: 838
void draw() {
background(13);
for (Line ml : middleLines) {//what kind of loop this is?
ml.drawLine();
ml.update();
}
what is this for loop doing can't undertstand.Can any-one help me?
Upvotes: 0
Views: 47
Reputation: 42176
Lufritz's answer is correct, but I wanted to encourage you to Google this type of question.
Googling for loop colon returns a ton of results, including:
If you ever see syntax you're not sure about, just Google that syntax. You'll find a ton of tutorials online, which should always be your first stop.
Upvotes: 1
Reputation: 6673
This is a for-each loop. It iterates over every element in the given array. It is basically the same as this:
for (i = 0; i < middleLines.count; i++) {
Line ml = middleLines[i];
ml.drawLine();
ml.update();
}
If you have to go over every element use for-each. It just saves lines of code.
Upvotes: 0