loop syntax confusion
in
Programming Questions
•
2 years ago
Hello,
I currently have code which looks something like:
if (over1) {
square1 = move. // this is just pseudo code
button2pressed = false// this is just pseudo code
}
if (over2) {
square2 = move. // this is just pseudo code
button2pressed = false// this is just pseudo code
}
All the way to 8. All of these are true the majority of the time and need to run the majority of the time.
I want to use a for loop to simplify this, but I dont understand how the syntax applies to processing. When working with flash I tend to use for loops in the following way:
for (int i = 1; i < 10; i = i++) {
if (over+i) {
square+i = move. // this is just pseudo code
button+i+pressed = false// this is just pseudo code
//do something
}
}
Essentially you can just include 'i' in the variable names so that the loop determines what you run through. In flash simply adding the + tells it whats going on, I was wondering how to do the same thing in procesing?
Its a simple question but I just cant find what im looking for anywhere. Many thanks in advance.
1