Skip to content · ⁨コンテンツへスキップ⁩

Nested loops and patterns · ⁨ネストされたループとパターン⁩

A loop inside a loop

  • You can put one loop inside another. The inner loop runs fully for each step of the outer loop.
  • This is how you work with rows and columns, or compare every pair of items.
  • If the outer loop runs R times and the inner runs C times, the inner body runs R × C times.

A 3-by-4 grid of stars: the outer loop walks the rows, the inner loop walks the columns

Handout · ⁨プリント⁩

Log in or create account · ⁨ログインまたはアカウント作成⁩

IGCSE, A-Level & AP