Skip to content · ⁨Saltar al contenido⁩

Nested loops and patterns · ⁨Bucles anidados y patrones⁩

English

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.

Español

Un bucle dentro de otro

  • Puedes colocar un bucle dentro de otro. El bucle interior se ejecuta completamente por cada paso del bucle exterior.
  • Así es como se trabaja con filas y columnas, o al comparar cada par de elementos.
  • Si el bucle exterior se ejecuta R veces y el interior C veces, el cuerpo del bucle interior se ejecuta R × C veces.

Una cuadrícula de 3 por 4 de asteriscos: el bucle exterior recorre las filas, el bucle interior recorre las columnas

Handout · ⁨Material⁩

Log in or create account · ⁨Iniciar sesión o crear cuenta⁩

IGCSE, A-Level & AP