Skip to content

Nested loops & 2-D lists · ⁨嵌套循环与二维列表⁩

English

A loop inside a loop

  • You can put one loop inside another loop.
  • For every pass of the outer loop, the inner loop runs fully.
  • So an outer of 2 and an inner of 3 runs the body 2 × 3 = 6 times.
中文

循环里套循环

  • 你可以把一个循环放进另一个循环里面。
  • 外层循环每跑一轮,内层循环就完整地跑一遍。
  • 所以外层 2 次、内层 3 次,循环体会运行 2 × 3 = 6 次。

Handout

Log in or create account · ⁨登录或创建账户⁩

IGCSE, A-Level · ⁨IGCSE、A-Level⁩ & AP · ⁨与 AP⁩