xxxxxxxxxx
15
function setup() {
createCanvas(300, 300);
// initialization, condition, and incrementation all in one line
for (let xPos = 50; xPos < width; xPos = xPos + 50) {
drawOneHouseAt(xPos, random(200));
}
}
function drawOneHouseAt( x, y ) {
rect(x, 50+y, 40, 40);
line(x, 50+y, x+20, 30+y);
line(x+20, 30+y, x+40, 50+y);
}