Can you make an if statement that is so long that is stops functioning properly?
in
Programming Questions
•
5 months ago
I'm new to processing, and recently I've been working on a project for a coding class in which ive come accross a problem where my if statement simply stops working after a prolonged period of going through multiple if statements.
In the program, ive been using an if statement to trigger events in the program after a set amount of time has past within the program; ive been using the "else if" statement to achieve this.
example:
==============================
float time = 0.0;
void setup() {
}
void draw() {
time = time + 0.1;
if ((time >= 0.0) && (time < 7.7)) {
Event 1 happens
}
else if ((time > 7.7) && (time <9.0)) {
Event 2 happens
}
}
====================================
Ive made a several very very long If statement using this process and after a while one of them has stopped working now and I cannot find any problems on my part to account for it; any problems I am aware of at least. When I bring the code in question into a separate pde. file to run it by itself without the other parts of the code it works perfectly fine, which leads me to believe that their are either 2 problems with the code.
Either
A: there is another part of the code overlaping the code in question and it is simply being painted over the picture I want to draw; thats not very likely, ive looked over the code 7 separate times looking for any problems like this.
or
B: If statements stop working after a desginated amount of information has been coded into them.
So my question is, can you make an if statement that is so long that is stops functioning properly?
I would like to thank anyone who answered my post in advanced, I have tried everything I can think of other than asking people for help...
1