# 兩層 for 迴圈：排出一面格子

正式網址：https://newmediaart.course.monolab.world/tools/grid

for 裡面再包一層 for 就是格子；用 % 餘數決定哪一格換色，就能排出花磚那種規律。

- **分類**：程式結構
- **概念**：迴圈、巢狀迴圈、格子、餘數、花磚、規律、重複
- **p5.js**：for、%、rect()、fill()、random()
- **誕生**：[第 1 堂](https://newmediaart.course.monolab.world/lesson/01)

拉滑桿、看畫面，旁邊的程式碼會跟著變，整段複製到 OpenProcessing 就能跑。

## 同類模組・程式結構

- [變數是抽屜：x = x + 速度](https://newmediaart.course.monolab.world/tools/variable)
- [for 迴圈：一圈一圈看它畫](https://newmediaart.course.monolab.world/tools/forloop)
- [函數：把一朵花打包成 drawFlower()](https://newmediaart.course.monolab.world/tools/func)

[回到全部模組](https://newmediaart.course.monolab.world/tools)

[到 Hahow 報名](https://hahow.in/cr/creative-code)。價格與優惠以 Hahow 頁面為準。
