# Nested Loops & Grids **Track:** Foundations — Creative Coding — the existing 50 **Framework / surface:** p5.js **Level:** Beginner **Prerequisites:** Loops **In one line:** A loop inside a loop walks rows and columns — the basis of grids and fields. ## Theory, aesthetics & inspiration Place one loop inside another and iteration becomes two-dimensional: the outer counter walks the rows, the inner counter the columns, and together they populate a grid. The grid is modernism's deep structure — Josef Müller-Brockmann codified it in "Grid Systems in Graphic Design," and the Bauhaus and Swiss schools treated it as the rational armature beneath every composition. In painting, Agnes Martin's penciled lattices and Vera Molnár's perturbed matrices show the grid as both discipline and ground for deviation. Computationally, the double loop makes the grid generative: every cell receives an address, and any rule applied across that field — color, size, rotation — produces systematic, surveyable variation.