Code

size (480,100);
background (200,200,200);
int spacing = (width/6);

for (int x=(width/12); x<width; x+=spacing) {
  for (int y=(spacing/3); y<(spacing); y+=5) {
    line (x+(y-2*(spacing/3)),25, x,75);
  }
}

0202 - Nested Iteration II: Not a 'grid'

Statement:As you have seen, nested iteration is often used to create two-dimensional grids. But it's actually much more versatile than this, since it can be used to create any repetition of (internally repetitive) elements.

Use a single pair of nested for{} loops to reproduce the pattern illustrated here : a group of six "fans", each of which has ten (oops, eleven! Thanks Moshe!) lines.

hide statement