xxxxxxxxxx
void setup() {
size(600,400);
background(100);
frameRate(2);
}
void draw() {
int ran = int(random(255));
fill(0,0,ran);//blue
manyRects(15,0,50,50);//call to the function
fill(255,0,0);//red
manyRects(50,100,50,50);
fill(0,255,0);//green
manyRects(15,350,50,50);
}
void manyRects(int num, int y,int myWidth, int myHeight){//signature of the function
for(int i=0;i<num;i++){
rect(50*i,y,myWidth,myHeight);
}
}