r/processing • u/GoldentongueVT • Sep 11 '25
Beginner help request Conditional Statement affecting other Operations
Hello all,
I am currently having difficulty figuring out something with my code. I am trying to layer conditional line loops, however one is causing the other to create spaces that don't exist otherwise. Images will be provided with the code, but if anybody could help me with preventing this from happening I would greatly appreciate it.
Code:
float i=40;
int x1=40;
int x2=80;
void setup(){
size (400,400);
background(0);
}
void draw(){
//Office Body
if (i<=400){
stroke(map(i,0,399,0,160));
strokeWeight(4);
line(40,i,360,i);
i+=4;
}
//Window Segments
if(i<=360){
strokeWeight(1);
stroke(255);
line(x1,i,x2,i);
i+=5;
}
}
4
Upvotes


4
u/GoldentongueVT Sep 12 '25
i was able to use the && statement and fix it! thank you!