using For, is and else

Hello, I'm a newbie so sorry if I don't have all of the language. I have to use for, is and else for my school work. I have 4 rect in 4 different places in my drawing. I would like for them to grow like a stem of a flower. I'm stuck, this is what I used.

function stem(coordX,coordY){
  fill("green");
  rect(coordX,coordY, 30, 120);

  for(i=coordX,coordY;i<=120;i=i+15){
  stem(i);
  }//fin de for

}//fin stem
function draw() {
  stem(1200,1200);
  stem(640,1200);
  stem(400,1200);
  stem(2000,1200);
}

you can see it here:https://www.openprocessing.org/sketch/449048

Thank you

Answers

Sign In or Register to comment.