Workshop › Memory › Step 5 of 25
A loop inside a loop: the outer loop goes down the rows, and for each row the inner loop draws the row's four cards. 4 × 4 = 16 cards.
```js
for (let row = 0; row < SIZE; row++) {
for (let col = 0; col < SIZE; col++) {
ctx.fillRect(GAP + col * (CARD + GAP), TOP + GAP + row * (CARD + GAP), CARD, CARD)
}
}
```row = 0 to 3); each time, the inner loop runs 4 times.TOP + GAP + row * (CARD + GAP).Put the loop inside a new row loop and change the y part of fillRect as shown. Press Run.
Skills: Loops
← A row of cards Every fruit twice →